diff --git a/app.js b/app.js index 6904c9f..54b796f 100644 --- a/app.js +++ b/app.js @@ -31,6 +31,7 @@ App({ }) }, globalData: { - userInfo: {} + userInfo: {}, + token: 'T3hrM2Y1eFB5eERaNXQ2bDdxZ3Y4elZVQnl6U3FWdlNBT3dGUENFNlNObjA5MWpTMW1CMG1iaSsvZmxGcERlMzV5RWw5TnplZjVIbmVQRTQ5SkVnWFF3YjdvWnVaRHhrL2l5TUNGWmFZcnJZVzI5UEhJdFVzdG55b3RLOTdKTzhmeFZvZ1hTd29qbnlYeWVSMURiTmpNNGJDOTFVbDVsMk5Ed3FiREh2QnpCN0RRSTM3eVViN2NvK1VQbzZiMXQyL1VodDhPaUwrd2pSU3RTWWFiYWlCbFQ4blZoRHo2c3BObFRaY1pTMjR3cW5VLzl6SEswemNoS0V2SGNLMXJiU2QrdGxOajJXeWtqYWEwbDhOTzRod00xQTdWNUxFOU9Wd1FkUWJwSHoramFPdUJ0MG9UbEJocFUzTkZiUy83Q2xaL2RVSXhLYnNMNGZhYm5DZ1VXOUtVUVVQR2FMQjFqaCs0NVowVDJrMFpjUFdpK0dZb0JKVWxTOCswamVXbkZQUWk5Vi9hQ0h3ci93QzJpVDA1aEt2ZlM1NWlPOW5MTGFNdmhLZDM4K0lscC9jejR2c29ON1dLeXhSbXF3QVNtNQ==' }, }) \ No newline at end of file diff --git a/app.json b/app.json index 8d56040..30fc878 100644 --- a/app.json +++ b/app.json @@ -1,59 +1,64 @@ { - "pages": [ - "pages/index/index", - "pages/mine/index/index" - ], - "window": { - "backgroundTextStyle": "dark", - "navigationBarBackgroundColor": "#fff", - "navigationBarTitleText": "名片", - "navigationBarTextStyle": "black", - "navigationStyle": "custom" - }, - "tabBar": { - "color": "#8F8F8F", - "selectedColor": "#1296db", - "borderStyle": "black", - "list": [{ - "text": "首页", - "pagePath": "pages/index/index", - "iconPath": "images/ic_card_normal.png", - "selectedIconPath": "images/ic_card_sel.png" - }, - { - "text": "我的", - "pagePath": "pages/mine/index/index", - "iconPath": "images/ic_mine_normal.png", - "selectedIconPath": "images/ic_mine_sel.png" - } - ] - }, - "style": "v2", - "sitemapLocation": "sitemap.json", - "usingComponents": { - "cu-custom": "/components/cuicustom/cu-custom", - "customcart": "/components/cartfoot/customcart", - "van-tabbar": "/vant/dist/tabbar/index", - "van-tabbar-item": "/vant/dist/tabbar-item/index", - "van-swipe-cell": "/vant/dist/swipe-cell/index", - "van-cell-group": "/vant/dist/cell-group/index", - "van-cell": "/vant/dist/cell/index", - "van-empty": "/vant/dist/empty/index", - "van-action-sheet": "/vant/dist/action-sheet/index", - "van-submit-bar": "/vant/dist/submit-bar/index", - "van-stepper": "/vant/dist/stepper/index", - "van-image": "/vant/dist/image/index", - "van-loading": "/vant/dist/loading/index" - }, - "plugins": { - "chooseLocation": { - "version": "1.0.6", - "provider": "wx76a9a06e5b4e693e" + "pages": [ + "pages/index/index", + "pages/mine/index/index", + "pages/moments/publish/momentpublish", + "pages/moments/edit/momentedit", + "pages/moments/list/momentslist", + "pages/moments/publish/momentpublishline" + ], + "window": { + "backgroundTextStyle": "dark", + "navigationBarBackgroundColor": "#fff", + "navigationBarTitleText": "名片", + "navigationBarTextStyle": "black", + "navigationStyle": "custom" + }, + "tabBar": { + "color": "#8F8F8F", + "selectedColor": "#1296db", + "borderStyle": "black", + "list": [ + { + "text": "首页", + "pagePath": "pages/index/index", + "iconPath": "images/ic_card_normal.png", + "selectedIconPath": "images/ic_card_sel.png" + }, + { + "text": "我的", + "pagePath": "pages/mine/index/index", + "iconPath": "images/ic_mine_normal.png", + "selectedIconPath": "images/ic_mine_sel.png" + } + ] + }, + "style": "v2", + "sitemapLocation": "sitemap.json", + "usingComponents": { + "cu-custom": "/components/cuicustom/cu-custom", + "customcart": "/components/cartfoot/customcart", + "van-tabbar": "/vant/dist/tabbar/index", + "van-tabbar-item": "/vant/dist/tabbar-item/index", + "van-swipe-cell": "/vant/dist/swipe-cell/index", + "van-cell-group": "/vant/dist/cell-group/index", + "van-cell": "/vant/dist/cell/index", + "van-empty": "/vant/dist/empty/index", + "van-action-sheet": "/vant/dist/action-sheet/index", + "van-submit-bar": "/vant/dist/submit-bar/index", + "van-stepper": "/vant/dist/stepper/index", + "van-image": "/vant/dist/image/index", + "van-loading": "/vant/dist/loading/index" + }, + "plugins": { + "chooseLocation": { + "version": "1.0.6", + "provider": "wx76a9a06e5b4e693e" + } + }, + "permission": { + "scope.userLocation": { + "desc": "你的位置信息将用于小程序定位" + } } - }, - "permission": { - "scope.userLocation": { - "desc": "你的位置信息将用于小程序定位" - } - } } \ No newline at end of file diff --git a/class/main.wxss b/class/main.wxss index 57543ab..fe1e00d 100644 --- a/class/main.wxss +++ b/class/main.wxss @@ -2415,7 +2415,6 @@ button.icon.lg { .cu-form-group { background-color: var(--white); - padding: 1rpx 20rpx; display: flex; align-items: center; min-height: 100rpx; @@ -3008,6 +3007,10 @@ scroll-view.cu-steps .cu-item { align-self: flex-center; } +.selfcenter { + align-self: center; +} + .self-end { align-self: flex-end; } @@ -4125,6 +4128,29 @@ l .text-depblack { padding: 10rpx 0rpx; } +.play-box-arrow-flex { + width: 100%; + height: 100%; + display: flex; + position: absolute; + justify-content: center; + align-items: center; +} + +.play-box-arrow-pos { + top: 40rpx; + left: 40rpx; + position: absolute; + width: 100%; + height: 100%; +} + +.shadow-box { + width: 100%; + border-radius: 10rpx; + border: 1rpx solid #f5f5f5; +} + .border-blue-radius { border-radius: 20rpx; border: 1rpx solid #0054bd; @@ -4166,7 +4192,7 @@ l .text-depblack { } .line-gray-ssm { - background-color: #cecece; + background-color: #eee; height: 2rpx; } diff --git a/images/ic_arrow_down.png b/images/ic_arrow_down.png new file mode 100644 index 0000000..ef59184 Binary files /dev/null and b/images/ic_arrow_down.png differ diff --git a/images/ic_arrow_up.png b/images/ic_arrow_up.png new file mode 100644 index 0000000..8670240 Binary files /dev/null and b/images/ic_arrow_up.png differ diff --git a/images/ic_audio_play.png b/images/ic_audio_play.png new file mode 100644 index 0000000..7c73ce5 Binary files /dev/null and b/images/ic_audio_play.png differ diff --git a/images/ic_audio_playing.png b/images/ic_audio_playing.png new file mode 100644 index 0000000..c2756ec Binary files /dev/null and b/images/ic_audio_playing.png differ diff --git a/images/ic_audio_rewind.png b/images/ic_audio_rewind.png new file mode 100644 index 0000000..238ed04 Binary files /dev/null and b/images/ic_audio_rewind.png differ diff --git a/images/ic_audio_speed.png b/images/ic_audio_speed.png new file mode 100644 index 0000000..22dccea Binary files /dev/null and b/images/ic_audio_speed.png differ diff --git a/images/ic_empty_desc.png b/images/ic_empty_desc.png new file mode 100644 index 0000000..f350c93 Binary files /dev/null and b/images/ic_empty_desc.png differ diff --git a/images/ic_empty_map.png b/images/ic_empty_map.png new file mode 100644 index 0000000..e5e9f4c Binary files /dev/null and b/images/ic_empty_map.png differ diff --git a/images/ic_empty_text.png b/images/ic_empty_text.png new file mode 100644 index 0000000..f8eb158 Binary files /dev/null and b/images/ic_empty_text.png differ diff --git a/images/ic_empty_voice.png b/images/ic_empty_voice.png new file mode 100644 index 0000000..27f40c5 Binary files /dev/null and b/images/ic_empty_voice.png differ diff --git a/images/ic_record_start.png b/images/ic_record_start.png new file mode 100644 index 0000000..a13d65f Binary files /dev/null and b/images/ic_record_start.png differ diff --git a/images/ic_squareness_del.png b/images/ic_squareness_del.png new file mode 100644 index 0000000..35e3c50 Binary files /dev/null and b/images/ic_squareness_del.png differ diff --git a/images/ic_temp.png b/images/ic_temp.png new file mode 100644 index 0000000..7632d52 Binary files /dev/null and b/images/ic_temp.png differ diff --git a/images/ic_video_play.png b/images/ic_video_play.png new file mode 100644 index 0000000..2e8bf22 Binary files /dev/null and b/images/ic_video_play.png differ diff --git a/images/ic_voice_record.gif b/images/ic_voice_record.gif new file mode 100644 index 0000000..5cf6cd6 Binary files /dev/null and b/images/ic_voice_record.gif differ diff --git a/images/title-bg.png b/images/title-bg.png new file mode 100644 index 0000000..a7e94e2 Binary files /dev/null and b/images/title-bg.png differ diff --git a/pages/common/webpage/webpage.js b/pages/common/webpage/webpage.js new file mode 100644 index 0000000..d65ffba --- /dev/null +++ b/pages/common/webpage/webpage.js @@ -0,0 +1,22 @@ +// pages/common/webpage.js +const app = getApp() + +Page({ + + /** + * 页面的初始数据 + */ + data: { + url: '' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + url: options.url + }) + }, + +}) \ No newline at end of file diff --git a/pages/common/webpage/webpage.json b/pages/common/webpage/webpage.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/common/webpage/webpage.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/common/webpage/webpage.wxml b/pages/common/webpage/webpage.wxml new file mode 100644 index 0000000..2aa3f26 --- /dev/null +++ b/pages/common/webpage/webpage.wxml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/pages/common/webpage/webpage.wxss b/pages/common/webpage/webpage.wxss new file mode 100644 index 0000000..4e9e6ce --- /dev/null +++ b/pages/common/webpage/webpage.wxss @@ -0,0 +1 @@ +/* pages/common/webpage.wxss */ \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js index 6f433a8..c1677a4 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -6,5 +6,63 @@ Page({ data: { nameTxt: '名片' }, + onLoad(options) { + this.doLogin() + }, + show() { + wx.navigateTo({ + url: '/pages/moments/publish/momentpublish', + }) + }, + showList() { + wx.navigateTo({ + url: '/pages/moments/list/momentslist', + }) + }, + // 登录 + doLogin() { + var self = this; + wx.showLoading({ + title: '加载中...', + }) + wx.login({ + success(res) { + app.http.post(app.urls.wxLogin, { + data: { + jsCode: res.code + } + }) + .then(res => { + wx.hideLoading({}) + console.log(res) + var token = res.data.data.split('_')[0] + wx.setStorageSync('token', token) + wx.setStorageSync('bindPhone', res.data.data.split('_')[1]) + app.globalData.token = token + }) + .catch(err => { + wx.hideLoading({}) + console.log(err) + }) + + // { + // jsCode: res.code + // }, null, function (code, data) { + // var token = data.data.split('_')[0] + // self.setData({ + // token: token, + // bindPhone: data.data.split('_')[1] + // }) + // wx.setStorageSync('token', token) + // wx.setStorageSync('bindPhone', data.data.split('_')[1]) + // app.globalData.token = token + // self.getUserInfo() + // self.getHomeColumnList() + // }, function (code, data) { + // app.dialog.msg(data.msg); + // }); + } + }) + }, }) \ No newline at end of file diff --git a/pages/index/index.wxml b/pages/index/index.wxml index aa14d5a..4393bfd 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -1,3 +1,11 @@ {{nameTxt}} - \ No newline at end of file + + + + 测试 + + + + 列表 + \ No newline at end of file diff --git a/pages/mine/index/index.js b/pages/mine/index/index.js index c32e1b1..195a46d 100644 --- a/pages/mine/index/index.js +++ b/pages/mine/index/index.js @@ -1,6 +1,5 @@ // pages/mine/index/index.js const app = getApp() -var audioContext = wx.createInnerAudioContext() Page({ /** @@ -12,17 +11,6 @@ Page({ userIcon: '../../../images/ic_user_default.png', menuList: [], imgUrl: app.urls.baseImgUrl, - audioFile: { - path: 'http://www.170mv.com/kw/antiserver.kuwo.cn/anti.s?rid=MUSIC_96145895&response=res&format=mp3|aac&type=convert_url&br=128kmp3&agent=iPhone&callback=getlink&jpcallback=getlink.mp3', - isPlay: false, - duration: 0, - curDuration: 0 - }, - speedStep: 5, //快进快退秒数 - curTimeStr: '00:00', - totalTimeStr: '00:60', //总时长 - waitFlag: false, - url: 'https://ossweb-img.qq.com/images/lol/img/champion/Morgana.png' }, /** * 生命周期函数--监听页面加载 @@ -32,8 +20,8 @@ Page({ _self.setData({ nickName: app.globalData.userInfo.name }) - _self.checkPermission() - + // _self.checkPermission() + _self.getItemList() }, getItemList() { wx.showLoading({ @@ -46,9 +34,12 @@ Page({ } }) .then(res => { + var data = res.data wx.stopPullDownRefresh({}) wx.hideLoading({}) - data.sort((a, b) => a.configSort - b.configSort) + data.forEach(it => { + it.configColumnList.sort((a, b) => a.configColumnOrder - b.configColumnOrder) + }) _self.setData({ menuList: data }) @@ -77,7 +68,7 @@ Page({ success(res) { console.log(res) if (res.confirm) { - _self.getUserProfile(3) + // _self.getUserProfile(3) } } }) @@ -137,16 +128,18 @@ Page({ }) }, choosePage(e) { + // 栏目列表页跳转方式1:小程序页面,2:其他小程序,3:网址 var path = e.currentTarget.dataset.path var type = e.currentTarget.dataset.type + var item = e.currentTarget.dataset.item switch (type) { - case 'mini': //跳转小程序内部 - case 'webview': //链接 + case '1': //跳转小程序内部 + case '3': //链接 wx.navigateTo({ - url: path, + url: path + '?id=' + item.configColumnId + '&mode=' + item.configTableMode + '&type=' + item.configColumnType }) break - case 'othermini': //其他小程序 + case '2': //其他小程序 wx.navigateToMiniProgram({ appId: '', success(res) { @@ -159,105 +152,5 @@ Page({ onPullDownRefresh() { this.getItemList() }, - play() { - var _self = this - if (_self.data.audioFile.isPlay) { - audioContext.stop() - } else { - audioContext.src = _self.data.audioFile.path - audioContext.autoplay = true - } - audioContext.onCanplay((res) => { - if (_self.data.waitFlag) { - audioContext.play() - _self.setData({ - waitFlag: false - }) - } - }) - audioContext.onPlay((res) => { - _self.data.audioFile.isPlay = true - _self.setData({ - audioFile: _self.data.audioFile - }) - }) - audioContext.onStop((res) => { - _self.data.audioFile.isPlay = false - _self.data.audioFile.curDuration = 0 - _self.setData({ - audioFile: _self.data.audioFile, - curTimeStr: '00:00' - }) - }) - audioContext.onEnded((res) => { - _self.data.audioFile.isPlay = false - _self.data.audioFile.curDuration = 0 - _self.setData({ - audioFile: _self.data.audioFile, - curTimeStr: '00:00' - }) - }) - audioContext.onError((res) => { - _self.data.audioFile.isPlay = false - _self.data.audioFile.curDuration = 0 - _self.setData({ - audioFile: _self.data.audioFile, - curTimeStr: '00:00' - }) - }) - audioContext.onSeeking(() => { - console.log(audioContext.currentTime) - }) - audioContext.onWaiting(() => { - audioContext.pause() - _self.setData({ - waitFlag: true - }) - }) - audioContext.onTimeUpdate(() => { - _self.data.audioFile.curDuration = parseInt(audioContext.currentTime) - _self.data.audioFile.duration = parseInt(audioContext.duration) - var curM = parseInt(audioContext.currentTime / 60) //分钟 - var curS = parseInt(audioContext.currentTime % 60) //秒 - var tM = parseInt(audioContext.duration / 60) //分钟 - var tS = parseInt(audioContext.duration % 60) //秒 - var curMStr = curM > 9 ? curM : '0' + curM - var curSStr = curS > 9 ? curS : '0' + curS - var totalMStr = tM > 9 ? tM : '0' + tM - var totalSStr = +tS > 9 ? tS : '0' + tS - _self.setData({ - audioFile: _self.data.audioFile, - curTimeStr: curMStr + ':' + curSStr, - totalTimeStr: totalMStr + ':' + totalSStr - }) - }) - }, - //倒退5秒 - rewind() { - var _self = this - if (_self.data.audioFile.isPlay) { - _self.data.audioFile.curDuration = _self.data.audioFile.curDuration - _self.data.speedStep - audioContext.seek(_self.data.audioFile.curDuration) - _self.setData({ - audioFile: _self.data.audioFile - }) - } - }, - //快进5秒 - speed() { - var _self = this - if (_self.data.audioFile.isPlay) { - _self.data.audioFile.curDuration = _self.data.audioFile.curDuration + _self.data.speedStep - audioContext.seek(_self.data.audioFile.curDuration) - _self.setData({ - audioFile: _self.data.audioFile - }) - } - }, - slider4change(e) { - if (this.data.audioFile.isPlay) { - audioContext.seek(e.detail.value) - } - } }) \ No newline at end of file diff --git a/pages/mine/index/index.wxml b/pages/mine/index/index.wxml index f50c720..100045a 100644 --- a/pages/mine/index/index.wxml +++ b/pages/mine/index/index.wxml @@ -11,12 +11,60 @@ - + - - - + + + + + + + {{item.configColumnName}} + + + + + + + + + + + + + {{item.configColumnName}} + + + {{item.configColumnRemark}} + + + + + + + + + + + + + + + + + + + + + + - - - - - - {{subItem.name}} - - - - + --> + + + + \ No newline at end of file + --> \ No newline at end of file diff --git a/pages/moments/edit/momentedit.js b/pages/moments/edit/momentedit.js new file mode 100644 index 0000000..726c83e --- /dev/null +++ b/pages/moments/edit/momentedit.js @@ -0,0 +1,834 @@ +const app = getApp() +const recorderManager = wx.getRecorderManager() +var innerAudioContext = wx.createInnerAudioContext() +const chooseLocation = requirePlugin('chooseLocation'); +const key = 'Y6FBZ-GLQC3-6273Q-3DRTL-W43G5-G6BXN'; //使用在腾讯位置服务申请的key +const referer = '名片-小程序'; //调用插件的app的名称 +const location = JSON.stringify({ + latitude: 39.89631551, + longitude: 116.323459711 +}); +const category = '生活服务,娱乐休闲'; +Page({ + + /** + * 页面的初始数据 + */ + data: { + uploadCount: 0, + uploadVideoCount: 0, + textList: [], //文本添加内容 + textareaList: [], //文本域添加内容 + audioList: [], //音频添加内容 + videoList: [], //视频添加内容 + photoList: [], //视频添加内容 + linkList: [], //连接添加内容 + locationList: [], //定位添加内容 + isShowText: false, //文本弹窗开关 + isShowDesc: false, //文本域弹窗开关 + isShowPhoto: false, //图片选择弹框 + isShowLink: false, //链接弹窗 + isShowAudio: false, //录音弹窗 + isShowVideo: false, //视频弹窗 + tempText: '', + tempDesc: '', + linkStr: '', + map: null, + waitFlag: false, + isStartRecord: false, //是否录音中 + speck_time: 0, + speedStep: 5, //快进快退秒数 + setInter: '', //定时器 + currentItem: undefined, + items: [{ + title: '标题', //标题 + count: 3, //数量 + type: 'TEXT', //类型 + }, { + title: '标题', //标题 + count: 9, //数量 + type: 'TEXTAREA', //类型 + }, { + title: '标题', //标题 + count: 2, //数量 + type: 'AUDIO', //类型 + }, { + title: '标题', //标题 + count: 3, //数量 + type: 'VIDEO', //类型 + }, { + title: '标题', //标题 + count: 9, //数量 + type: 'PHOTO', //类型 + }, { + title: '标题', //标题 + count: 9, //数量 + type: 'LINK', //类型 + }, { + title: '标题', //标题 + count: 2, //数量 + type: 'LOCATION', //类型 + }], + isAuthAudio: false + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + this.checkPermission() + }, + //申请录音权限 + checkPermission() { + var _self = this + wx.getSetting({ + success(res) { + var isAuth = res.authSetting['scope.record'] + if (typeof (isAuth) == 'undefined') { + wx.authorize({ + scope: 'scope.record', + success() { + _self.setData({ + isAuthAudio: true + }) + }, + fail() { + _self.setData({ + isAuthAudio: false + }) + } + }) + } else { + if (!isAuth) { + _self.openSetting() + } + } + } + }) + }, + openSetting() { + wx.showModal({ + title: '提示', + content: '发布内容需要您授权录音权限.', + success(res) { + if (res.confirm) { + wx.openSetting({ + withSubscriptions: true, + }) + } + } + }) + }, + onShow() { + if (chooseLocation.getLocation() != null) { + if (this.data.locationList.length < this.data.currentItem.count) { + this.data.locationList.push(chooseLocation.getLocation()) + this.setData({ + locationList: this.data.locationList + }) + } + } + var _self = this + wx.getSetting({ + withSubscriptions: true, + success(res) { + var isAuth = res.authSetting['scope.record'] + _self.setData({ + isAuthAudio: isAuth + }) + } + }) + + }, + onUnload() { + chooseLocation.setLocation(null) + this.setData({ + map: null + }) + }, + //选择视频来源 + chooseVideo(e) { + var _self = this + var countNum = _self.data.currentItem.count - _self.data.videoList.length + console.log(countNum) + var type = e.currentTarget.dataset.type + wx.chooseMedia({ + count: Number.parseInt(countNum), + mediaType: ['video'], + sourceType: [type], + maxDuration: 60, + success: (res) => { + if (res.tempFiles.length > 0) { + _self.doUploadVideo(1, res.tempFiles, _self.data.uploadVideoCount) + } + }, + fail: (err) => { + // console.log(err) + // wx.showToast({ + // title: '选取视频失败,(拍摄时长:60秒)', + // icon: 'none' + // }) + } + }) + }, + //上传视频 + doUploadVideo(type, paths, curIndex) { + console.log(paths) + wx.showLoading({ + title: '上传中...', + }) + let _self = this + var count = paths.length //几次 + if (_self.data.uploadVideoCount < count) { + app.http.upload(app.urls.doUploadVideo, { + path: paths[_self.data.uploadVideoCount].tempFilePath, + name: 'video', + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + //插入到集合中 + var id = JSON.parse(res).data + var pathStr = app.urls.baseImgUrl + id + var item = { + id: id, + path: pathStr, + imgPath: paths[_self.data.uploadVideoCount].thumbTempFilePath + } + _self.data.videoList.push(item) + _self.setData({ + videoList: _self.data.videoList + }) + _self.setData({ + uploadVideoCount: ++_self.data.uploadVideoCount + }) + _self.doUploadVideo(1, paths, _self.data.uploadVideoCount) + }) + .catch(err => { + wx.hideLoading({}) + _self.setData({ + uploadVideoCount: ++_self.data.uploadVideoCount + }) + _self.doUploadVideo(1, paths, _self.data.uploadVideoCount) + }) + } else { + wx.hideLoading({}) + _self.setData({ + uploadVideoCount: 0 + }) + } + }, + //预览视频 + viewVideo(e) { + var tempList = [{ + url: e.currentTarget.dataset.url, + type: 'video' + }] + wx.previewMedia({ + sources: tempList, + current: 0, + showmenu: false + }) + }, + //删除视频 + delVideo(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该视频吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.videoList.splice(e.currentTarget.dataset.index, 1) + _self.setData({ + videoList: _self.data.videoList + }) + } + } + }) + }, + //添加链接 + addLink() { + var _self = this + var item = null + for (var i = 0; i < _self.data.items.length; i++) { + if (_self.data.items[i].type == 'LINK') { + item = _self.data.items[i] + break + } + } + if (_self.data.linkList.length < item.count) { + if (_self.data.linkStr == '') { + wx.showToast({ + title: '请输入文字内容', + icon: 'error' + }) + return + } + _self.data.linkList.push(_self.data.linkStr) + _self.setData({ + linkList: _self.data.linkList, + linkStr: '' + }) + if (_self.data.linkList.length == item.count) { + _self.setData({ + isShowLink: false + }) + } + } + }, + //文本域添加输入的文字 + addDesc() { + var _self = this + var item = null + for (var i = 0; i < _self.data.items.length; i++) { + if (_self.data.items[i].type == 'TEXTAREA') { + item = _self.data.items[i] + break + } + } + if (_self.data.textareaList.length < item.count) { + if (_self.data.tempDesc == '') { + wx.showToast({ + title: '请输入文字内容', + icon: 'error' + }) + return + } + _self.data.textareaList.push(_self.data.tempDesc) + _self.setData({ + textareaList: _self.data.textareaList, + tempDesc: '' + }) + if (_self.data.textareaList.length == item.count) { + _self.setData({ + isShowDesc: false + }) + } + } + }, + //添加输入的文字 + addStr() { + var _self = this + var item = null + for (var i = 0; i < _self.data.items.length; i++) { + if (_self.data.items[i].type == 'TEXT') { + item = _self.data.items[i] + break + } + } + if (_self.data.textList.length < item.count) { + if (_self.data.tempText == '') { + wx.showToast({ + title: '请输入文字内容', + icon: 'error' + }) + return + } + _self.data.textList.push(_self.data.tempText) + _self.setData({ + textList: _self.data.textList, + tempText: '' + }) + if (_self.data.textList.length == item.count) { + _self.setData({ + isShowText: false + }) + } + } + }, + //删除 + delText(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该条数据吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.textList.splice(e.currentTarget.dataset.index, 1) + this.setData({ + textList: this.data.textList + }) + } + } + }) + }, + delLink(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该条数据吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.linkList.splice(e.currentTarget.dataset.index, 1) + this.setData({ + linkList: this.data.linkList + }) + } + } + }) + }, + delDesc(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该条数据吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.textareaList.splice(e.currentTarget.dataset.index, 1) + this.setData({ + textareaList: this.data.textareaList + }) + } + } + }) + }, + //监听输入的文字 + textInput(e) { + this.setData({ + [e.currentTarget.id]: e.detail.value + }) + }, + //关闭弹窗 + onHide(e) { + this.setData({ + isShowText: false, + isShowDesc: false, + isShowPhoto: false, + isShowLink: false, + isShowAudio: false, + isShowVideo: false + }) + }, + //选择图片 + choosePhoto(e) { + var _self = this + var countNum = _self.data.currentItem.count - _self.data.photoList.length + var type = e.currentTarget.dataset.type + wx.chooseImage({ + count: Number.parseInt(countNum), + sourceType: [type], + success: (res) => { + _self.doUploadImg(1, res.tempFilePaths, _self.data.uploadCount) + }, + fail: (err) => { + + } + }) + }, + //删除图片 + delImg(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.photoList.splice(e.currentTarget.dataset.index, 1) + this.setData({ + photoList: this.data.photoList + }) + } + } + }) + }, + //预览图片 + viewImg(e) { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + doUploadImg(type, paths, curIndex) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + var count = paths.length //几次 + if (_self.data.uploadCount < count) { + app.http.upload(app.urls.doUploadImg, { + path: paths[_self.data.uploadCount], + name: 'image', + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + //插入到集合中 + var id = JSON.parse(res).data + var pathStr = app.urls.baseImgUrl + id + var item = { + id: id, + path: pathStr + } + _self.data.photoList.push(item) + _self.setData({ + photoList: _self.data.photoList + }) + _self.setData({ + uploadCount: ++_self.data.uploadCount + }) + _self.doUploadImg(1, paths, _self.data.uploadCount) + }) + .catch(err => { + wx.hideLoading({}) + _self.setData({ + uploadCount: ++_self.data.uploadCount + }) + _self.doUploadImg(1, paths, _self.data.uploadCount) + }) + } else { + wx.hideLoading({}) + _self.setData({ + uploadCount: 0 + }) + } + }, + //地图选点 + chooseLocation() { + this.data.items.forEach(it => { + if (it.type == 'LOCATION') { + this.setData({ + currentItem: it + }) + } + }) + wx.navigateTo({ + url: `plugin://chooseLocation/index?key=${key}&referer=${referer}&location=${location}&category=${category}` + }); + }, + delMap(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该条数据吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.locationList.splice(e.currentTarget.dataset.index, 1) + this.setData({ + locationList: this.data.locationList + }) + } + } + }) + }, + //删除视频 + delAudio(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该音频吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.audioList.splice(e.currentTarget.dataset.index, 1) + _self.setData({ + audioList: _self.data.audioList + }) + } + } + }) + }, + doStartRecord() { + var _self = this + wx.getSetting({ + success(res) { + if (!res.authSetting['scope.record']) { + wx.authorize({ + scope: 'scope.record', + success() { + _self.startRecord() + } + }) + } else { + _self.startRecord() + } + } + }) + }, + startRecord() { + var that = this + that.data.setInter = setInterval( + function () { + var speck_time = parseInt(that.data.speck_time + 1); + that.setData({ + speck_time: parseInt(speck_time), + isStartRecord: true + }); + if (that.data.speck_time > 0 && that.data.speck_time <= 59) { + that.start(); + } else { + clearInterval(that.data.setInter); + // 获取到结束时间 + that.stop(); + wx.showToast({ + title: '录音最长60S哦!', + duration: 2000, + icon: "none" + }) + } + }, 1000); + }, + doEndRecord() { + var _self = this; + clearInterval(_self.data.setInter); + // 获取到结束时间 + if (_self.data.speck_time > 3) { + //清除计时器 即清除setInter + clearInterval(_self.data.setInter); + // 获取到结束时间 + _self.stop(true); + _self.setData({ + speck_time: "0", + isStartRecord: false + }) + } else { + //清除计时器 即清除setInter + clearInterval(_self.data.setInter); + // 获取到结束时间 + _self.stop(false); + wx.showToast({ + title: '录制时间过短', + duration: 2000, + icon: "none" + }) + _self.setData({ + speck_time: "0", + isStartRecord: false + }) + } + }, + //开始录音的时候 + start() { + const options = { + duration: 60000, + format: 'mp3', //音频格式,有效值 aac/mp3 + } + //开始录音 + recorderManager.start(options); + recorderManager.onStart(() => { + console.log('recorder start') + }); + //错误回调 + recorderManager.onError((res) => { + console.log(res); + _self.stop(false); + }) + }, + //停止录音 + stop(success) { + var _self = this + recorderManager.stop(); + recorderManager.onStop((res) => { + if (success) { + //进行录音文件上传 + _self.doUploadAudio(res) + } + }) + }, + doUploadAudio(audio) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + app.http.upload(app.urls.doUploadAudio, { + path: audio.tempFilePath, + name: 'audio', + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + if (_self.data.audioList.length < _self.data.currentItem.count) { + wx.hideLoading({}) + //插入到集合中 + var id = JSON.parse(res).data + var pathStr = app.urls.baseImgUrl + id + //计算时长 + var dur = parseInt(audio.duration / 1000) + var tM = parseInt(dur / 60) //分钟 + var tS = parseInt(dur % 60) //秒 + var totalMStr = tM > 9 ? tM : '0' + tM + var totalSStr = +tS > 9 ? tS : '0' + tS + var totalStr = totalMStr + ':' + totalSStr + var item = { + id: id, //id + path: pathStr, //地址 + isPlay: false, //是否播放中 + duration: dur, //时长 + curDuation: 0, + curDurationStr: '00:00', + totalDurationStr: totalStr + } + _self.data.audioList.push(item) + _self.setData({ + audioList: _self.data.audioList + }) + console.log(_self.data.audioList) + if (_self.data.audioList.length == _self.data.currentItem.count) { + _self.setData({ + isShowAudio: false + }) + } + } + }) + .catch(err => {}) + }, + play(e) { + + //进行播放 + var index = e.currentTarget.dataset.index + var item = e.currentTarget.dataset.item + var _self = this + _self.data.audioList.forEach(it => { + if (it.isPlay) { + innerAudioContext.stop() + } + it.isPlay = false + it.curDuation = 0 + it.curDuationStr = '00:00' + }) + if (!item.isPlay) { + // innerAudioContext.stop() + //找到该文件 + innerAudioContext = wx.createInnerAudioContext() + // 播放音频文件 + innerAudioContext.src = _self.data.audioList[index].path + innerAudioContext.autoplay = true + } + //先需要停止其他录音文件的播放 + + innerAudioContext.onPlay(() => { + _self.data.audioList[index].isPlay = true + _self.setData({ + audioList: _self.data.audioList + }) + }); + + innerAudioContext.onCanplay((res) => { + if (_self.data.waitFlag) { + innerAudioContext.play() + _self.setData({ + waitFlag: false + }) + } + }) + innerAudioContext.onStop((res) => { + _self.data.audioList[index].isPlay = false + _self.data.audioList[index].curDuration = 0 + _self.data.audioList[index].curDurationStr = '00:00' + _self.setData({ + audioList: _self.data.audioList, + }) + }) + innerAudioContext.onEnded((res) => { + _self.data.audioList[index].isPlay = false + _self.data.audioList[index].curDuration = 0 + _self.data.audioList[index].curDurationStr = '00:00' + _self.setData({ + audioList: _self.data.audioList, + }) + }) + innerAudioContext.onError((res) => { + _self.data.audioList[index].isPlay = false + _self.data.audioList[index].curDuration = 0 + _self.data.audioList[index].curDurationStr = '00:00' + _self.setData({ + audioList: _self.data.audioList, + }) + }) + innerAudioContext.onSeeking(() => { + console.log(innerAudioContext.currentTime) + }) + innerAudioContext.onWaiting(() => { + innerAudioContext.pause() + _self.setData({ + waitFlag: true + }) + }) + innerAudioContext.onTimeUpdate(() => { + if (innerAudioContext.duration != Infinity) { + _self.data.audioList[index].curDuration = parseInt(innerAudioContext.currentTime) + _self.data.audioList[index].duration = parseInt(innerAudioContext.duration) + console.log(innerAudioContext.duration) + var curM = parseInt(innerAudioContext.currentTime / 60) //分钟 + var curS = parseInt(innerAudioContext.currentTime % 60) //秒 + var tM = parseInt(innerAudioContext.duration / 60) //分钟 + var tS = parseInt(innerAudioContext.duration % 60) //秒 + var curMStr = curM > 9 ? curM : '0' + curM + var curSStr = curS > 9 ? curS : '0' + curS + var totalMStr = tM > 9 ? tM : '0' + tM + var totalSStr = +tS > 9 ? tS : '0' + tS + _self.data.audioList[index].curDurationStr = curMStr + ':' + curSStr + _self.data.audioList[index].totalDurationStr = totalMStr + ':' + totalSStr + _self.setData({ + audioList: _self.data.audioList + }) + } + }) + }, + //倒退5秒 + rewind(e) { + var _self = this + var index = e.currentTarget.dataset.index + var item = e.currentTarget.dataset.item + if (item.isPlay) { + _self.data.audioList[index].curDuration = _self.data.audioList[index].curDuration - _self.data.speedStep + innerAudioContext.seek(_self.data.audioList[index].curDuration) + _self.setData({ + audioList: _self.data.audioList + }) + } + + }, + //快进5秒 + speed(e) { + var _self = this + var index = e.currentTarget.dataset.index + var item = e.currentTarget.dataset.item + if (item.isPlay) { + _self.data.audioList[index].curDuration = _self.data.audioList[index].curDuration + _self.data.speedStep + innerAudioContext.seek(_self.data.audioList[index].curDuration) + _self.setData({ + audioList: _self.data.audioList + }) + } + }, + slider4change(e) { + var index = e.currentTarget.dataset.index + var item = e.currentTarget.dataset.item + if (item.isPlay) { + innerAudioContext.seek(e.detail.value) + } + }, + //显示弹框 + showDialog(e) { + var type = e.currentTarget.dataset.type + var keyType = e.currentTarget.dataset.keytype + console.log(e) + this.data.items.forEach(it => { + if (it.type == type) { + this.setData({ + currentItem: it + }) + return + } + }) + this.setData({ + [keyType]: true + }) + } +}) \ No newline at end of file diff --git a/pages/moments/edit/momentedit.json b/pages/moments/edit/momentedit.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/moments/edit/momentedit.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/moments/edit/momentedit.wxml b/pages/moments/edit/momentedit.wxml new file mode 100644 index 0000000..42d2a3c --- /dev/null +++ b/pages/moments/edit/momentedit.wxml @@ -0,0 +1,309 @@ + + 内容修改 + + + + + + + + 文本内容 + + + + + + {{txt}} + + + + + + + + + 用一段话,向名片访客介绍自己吧 + + + + 点击添加 + + + + + + + 文本域内容 + + + + + + {{txt}} + + + + + + + + + 用一段话,向名片访客介绍自己吧 + + + 点击添加 + + + + + + + 图片内容 + + + + {{'数量'+'('+photoList.length+'/'+ currentItem.count+')'}} + + + + + + + + + + + + + + + + 用一段话,向名片访客介绍自己吧 + + + 点击添加 + + + + + + + + 语音介绍 + + + + + + + + + {{audio.curDurationStr}} + + {{audio.totalDurationStr}} + + + + + + + + + + + + + + + + + 语音,可以给名片访客留下更深的印象 + + + 点击添加 + + + + + + + 视频内容 + + + + {{'数量'+'('+videoList.length+'/'+ currentItem.count+')'}} + + + + + + + + + + + + + + + + 用一段话,向名片访客介绍自己吧 + + + 点击添加 + + + + + + + + 链接 + + + + + + {{txt}} + + + + + + + + + 用一段话,向名片访客介绍自己吧 + + + + 点击添加 + + + + + + + 定位 + + + + + + + {{m.name}}-{{m.address}} + + + + + + + + + + + + + + 在地图上选取一个地点 + + + + 点击添加 + + + + + + + + + 00:{{speck_time>9 ? speck_time : '0'+ speck_time}} + 长按录音 + + + + + {{audioFile.isPlay ? '播放中:'+speck_time+'秒' : '时长:'+audioFile.duration+'秒'}} + + 点击播放 + 删除 + + + + + + + + 点击添加 + + + + + + + 点击添加 + + + + + + + 相册 + + + 相机 + + + + + + + + 相册 + + + 相机 + + + + + + + + + 点击添加 + + \ No newline at end of file diff --git a/pages/moments/edit/momentedit.wxss b/pages/moments/edit/momentedit.wxss new file mode 100644 index 0000000..b904865 --- /dev/null +++ b/pages/moments/edit/momentedit.wxss @@ -0,0 +1,49 @@ +/* pages/moments/publish/momentpublish.wxss */ + + +van-action-sheet input { + border: 1px solid rgb(194, 194, 194); + border-radius: 10rpx; + height: 60rpx; + line-height: 60rpx; + margin-top: 9rpx; + padding-left: 10rpx; +} + +van-action-sheet textarea { + border: 1px solid rgb(194, 194, 194); + border-radius: 10rpx; + margin-top: 9rpx; + padding: 10rpx; +} + +van-action-sheet .line { + height: 90rpx; + text-align: center; + line-height: 90rpx; + width: 90%; + border-top-width: 1rpx; + border-top-color: #f5f5f5; + border-top-style: solid; + border-bottom-width: 1rpx; + border-bottom-color: #f5f5f5; + border-bottom-style: solid; +} + +van-action-sheet .noline { + height: 90rpx; + text-align: center; + line-height: 90rpx; + width: 90%; +} + + +van-action-sheet .line:active { + color: black; + background-color: #f5f5f5; +} + +van-action-sheet .noline:active { + color: black; + background-color: #f5f5f5; +} \ No newline at end of file diff --git a/pages/moments/list/momentslist.js b/pages/moments/list/momentslist.js new file mode 100644 index 0000000..d0f96ee --- /dev/null +++ b/pages/moments/list/momentslist.js @@ -0,0 +1,316 @@ +// pages/moments/list/momentslist.js +const app = getApp() +var innerAudioContext = wx.createInnerAudioContext() +Page({ + + /** + * 页面的初始数据 + */ + data: { + columnId: '', + type: '', + speedStep: 5, //快进快退秒数 + waitFlag: false, + configMode: '2', //1单条数据 2多条数据 + dataList: [], + trendsList: [{ + auto: false, + seeMore: false, + text: '小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟', + }, { + auto: false, + seeMore: false, + text: '小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟小老弟', + }], + photoList: [{ + path: 'https://t7.baidu.com/it/u=2604797219,1573897854&fm=193&f=GIF' + }, + { + path: 'https://t7.baidu.com/it/u=2942499027,2479446682&fm=193&f=GIF' + }, + { + path: 'https://t7.baidu.com/it/u=3165657288,4248157545&fm=193&f=GIF' + }, + { + path: 'https://t7.baidu.com/it/u=3240224891,3518615655&fm=193&f=GIF' + }, + { + path: 'https://t7.baidu.com/it/u=3240224891,3518615655&fm=193&f=GIF' + } + ], + videoList: [{ + imgPath: '../../../images/ic_temp.png', + path: 'https://media.w3.org/2010/05/sintel/trailer.mp4' + }], + locationList: [{ + name: '满都海公园', + address: '乌兰察布西街南', + latitude: 40.816084, + longitude: 111.688774 + }], + audioList: [{ + id: '', //id + path: 'http://em.sycdn.kuwo.cn/0e15005756dcda91a39bec26dd824614/60d99781/resource/n3/30/66/2205407643.mp3', //地址 + isPlay: false, //是否播放中 + duration: 100, //时长 + curDuation: 0, + curDurationStr: '00:00', + totalDurationStr: '00:56' + }, { + id: '', //id + path: 'http://em.sycdn.kuwo.cn/0e15005756dcda91a39bec26dd824614/60d99781/resource/n3/30/66/2205407643.mp3', //地址 + isPlay: false, //是否播放中 + duration: 100, //时长 + curDuation: 0, + curDurationStr: '00:00', + totalDurationStr: '00:56' + }], + linkList: [{ + url: 'https://www.baidu.com' + }, { + url: 'https://www.baidu.com' + }, { + url: 'https://www.baidu.com' + }], + count: 2, + isLoadMore: false + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + const query = wx.createSelectorQuery() + let _self = this + console.log(options.type) + _self.setData({ + columnId: options.id, + configMode: options.mode, + type: options.type + }) + query.selectAll('.textFour_box').boundingClientRect(res => { + var lineHeight = 26 + for (var i = 0; i < res.length; i++) { + if (res[i].height / lineHeight > 3) { + _self.data.trendsList[i].auto = true + _self.data.trendsList[i].seeMore = true + } + } + _self.setData({ + trendsList: _self.data.trendsList + }) + }).exec() + query.select('#it').boundingClientRect(res => { + if (res.height > app.globalData.windowHeight) { + + } + }).exec() + _self.getList() + }, + //获取栏目数据 + getList() { + var _self = this + wx.showLoading({}) + app.http.get(app.urls.getMomentsList.format({ + configColumnId: _self.data.columnId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + dataList: res.data + }) + }) + .catch(err => { + console.log(err) + }) + }, + //展开更多 + toggleHandler: function (e) { + var that = this; + var index = e.currentTarget.dataset.index; + for (var i = 0; i < that.data.trendsList.length; i++) { + if (index == i) { + that.data.trendsList[index].auto = true; + that.data.trendsList[index].seeMore = false; + } + } + that.setData({ + trendsList: that.data.trendsList + }) + }, + //收起更多 + toggleContent: function (e) { + var that = this; + var index = e.currentTarget.dataset.index; + for (var i = 0; i < that.data.trendsList.length; i++) { + if (index == i) { + that.data.trendsList[index].auto = true; + that.data.trendsList[index].seeMore = true; + } + } + that.setData({ + trendsList: that.data.trendsList + }) + }, + //预览图片 + viewImg(e) { + wx.previewImage({ + urls: [e.currentTarget.dataset.url], + }) + }, + viewVideo(e) { + var url = e.currentTarget.dataset.url + wx.previewMedia({ + sources: [{ + url: url, + type: 'video' + }], + }) + }, + onPullDownRefresh() { + wx.stopPullDownRefresh({}) + }, + onReachBottom() { + console.log('触底了') + }, + play(e) { + + //进行播放 + var index = e.currentTarget.dataset.index + var item = e.currentTarget.dataset.item + var _self = this + _self.data.audioList.forEach(it => { + if (it.isPlay) { + innerAudioContext.stop() + } + it.isPlay = false + it.curDuation = 0 + it.curDuationStr = '00:00' + }) + if (!item.isPlay) { + // innerAudioContext.stop() + //找到该文件 + innerAudioContext = wx.createInnerAudioContext() + // 播放音频文件 + innerAudioContext.src = _self.data.audioList[index].path + innerAudioContext.autoplay = true + } + //先需要停止其他录音文件的播放 + + innerAudioContext.onPlay(() => { + _self.data.audioList[index].isPlay = true + _self.setData({ + audioList: _self.data.audioList + }) + }); + + innerAudioContext.onCanplay((res) => { + if (_self.data.waitFlag) { + innerAudioContext.play() + _self.setData({ + waitFlag: false + }) + } + }) + innerAudioContext.onStop((res) => { + _self.data.audioList[index].isPlay = false + _self.data.audioList[index].curDuration = 0 + _self.data.audioList[index].curDurationStr = '00:00' + _self.setData({ + audioList: _self.data.audioList, + }) + }) + innerAudioContext.onEnded((res) => { + _self.data.audioList[index].isPlay = false + _self.data.audioList[index].curDuration = 0 + _self.data.audioList[index].curDurationStr = '00:00' + _self.setData({ + audioList: _self.data.audioList, + }) + }) + innerAudioContext.onError((res) => { + _self.data.audioList[index].isPlay = false + _self.data.audioList[index].curDuration = 0 + _self.data.audioList[index].curDurationStr = '00:00' + _self.setData({ + audioList: _self.data.audioList, + }) + }) + innerAudioContext.onSeeking(() => { + console.log(innerAudioContext.currentTime) + }) + innerAudioContext.onWaiting(() => { + innerAudioContext.pause() + _self.setData({ + waitFlag: true + }) + }) + innerAudioContext.onTimeUpdate(() => { + if (innerAudioContext.duration != Infinity) { + _self.data.audioList[index].curDuration = parseInt(innerAudioContext.currentTime) + _self.data.audioList[index].duration = parseInt(innerAudioContext.duration) + console.log(innerAudioContext.duration) + var curM = parseInt(innerAudioContext.currentTime / 60) //分钟 + var curS = parseInt(innerAudioContext.currentTime % 60) //秒 + var tM = parseInt(innerAudioContext.duration / 60) //分钟 + var tS = parseInt(innerAudioContext.duration % 60) //秒 + var curMStr = curM > 9 ? curM : '0' + curM + var curSStr = curS > 9 ? curS : '0' + curS + var totalMStr = tM > 9 ? tM : '0' + tM + var totalSStr = +tS > 9 ? tS : '0' + tS + _self.data.audioList[index].curDurationStr = curMStr + ':' + curSStr + _self.data.audioList[index].totalDurationStr = totalMStr + ':' + totalSStr + _self.setData({ + audioList: _self.data.audioList + }) + } + }) + }, + //倒退5秒 + rewind(e) { + var _self = this + var index = e.currentTarget.dataset.index + var item = e.currentTarget.dataset.item + if (item.isPlay) { + _self.data.audioList[index].curDuration = _self.data.audioList[index].curDuration - _self.data.speedStep + innerAudioContext.seek(_self.data.audioList[index].curDuration) + _self.setData({ + audioList: _self.data.audioList + }) + } + + }, + //快进5秒 + speed(e) { + var _self = this + var index = e.currentTarget.dataset.index + var item = e.currentTarget.dataset.item + if (item.isPlay) { + _self.data.audioList[index].curDuration = _self.data.audioList[index].curDuration + _self.data.speedStep + innerAudioContext.seek(_self.data.audioList[index].curDuration) + _self.setData({ + audioList: _self.data.audioList + }) + } + }, + slider4change(e) { + var index = e.currentTarget.dataset.index + var item = e.currentTarget.dataset.item + if (item.isPlay) { + innerAudioContext.seek(e.detail.value) + } + }, + //删除 + delItem(e) { + + }, + doPublish() { + wx.navigateTo({ + url: '../publish/momentpublishline?id=' + this.data.columnId, + }) + } +}) \ No newline at end of file diff --git a/pages/moments/list/momentslist.json b/pages/moments/list/momentslist.json new file mode 100644 index 0000000..7360326 --- /dev/null +++ b/pages/moments/list/momentslist.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "enablePullDownRefresh": true +} \ No newline at end of file diff --git a/pages/moments/list/momentslist.wxml b/pages/moments/list/momentslist.wxml new file mode 100644 index 0000000..e12a3a5 --- /dev/null +++ b/pages/moments/list/momentslist.wxml @@ -0,0 +1,113 @@ + + 内容列表 + + + + + 发表时间:2021年12月12日 12:12:12 + + + + + + + {{item.text}} + + 查看更多 + + + + 收起 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{audio.curDurationStr}} + + {{audio.totalDurationStr}} + + + + + + + + + + + + + + {{link.url}} + + + 打开 + + + + + + + + + {{m.name}}-{{m.address}} + + + + + + + + + + + + + + + + 加载中... + \ No newline at end of file diff --git a/pages/moments/list/momentslist.wxss b/pages/moments/list/momentslist.wxss new file mode 100644 index 0000000..de33d47 --- /dev/null +++ b/pages/moments/list/momentslist.wxss @@ -0,0 +1,50 @@ +/* pages/moments/list/momentslist.wxss */ + +.box { + margin: 0rpx 10rpx; +} + +.text_box { + width: 100%; + font-size: 30rpx; + font-weight: 400; + line-height: 48rpx; +} + +.textFour_box { + width: 100%; + font-size: 30rpx; + font-weight: 400; + line-height: 26px; + text-align: justify; +} + +.toggle-icon { + width: 25rpx; + height: 25rpx; +} + +.text_toggloe_box { + display: flex; + justify-content: left; + flex-direction: row; + align-items: center; + margin: 10rpx 0; +} + +.text_toggle_text { + font-size: 30rpx; + line-height: 32rpx; + margin-right: 10rpx; + color: black; +} + +.three { + text-overflow: -o-ellipsis-lastline; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 3; + line-clamp: 3; + -webkit-box-orient: vertical; +} \ No newline at end of file diff --git a/pages/moments/publish/momentpublish.js b/pages/moments/publish/momentpublish.js new file mode 100644 index 0000000..f85256f --- /dev/null +++ b/pages/moments/publish/momentpublish.js @@ -0,0 +1,862 @@ +const app = getApp() +const recorderManager = wx.getRecorderManager() +var innerAudioContext = wx.createInnerAudioContext() +const chooseLocation = requirePlugin('chooseLocation'); +const key = 'Y6FBZ-GLQC3-6273Q-3DRTL-W43G5-G6BXN'; //使用在腾讯位置服务申请的key +const referer = '名片-小程序'; //调用插件的app的名称 +const location = JSON.stringify({ + latitude: 39.89631551, + longitude: 116.323459711 +}); +const category = '生活服务,娱乐休闲'; +Page({ + + /** + * 页面的初始数据 + */ + data: { + uploadCount: 0, + uploadVideoCount: 0, + columnId: '', //栏目Id + fieldList: [], //栏目字段 + textList: [], //文本添加内容 + textareaList: [], //文本域添加内容 + audioList: [], //音频添加内容 + videoList: [], //视频添加内容 + photoList: [], //视频添加内容 + linkList: [], //连接添加内容 + locationList: [], //定位添加内容 + isShowText: false, //文本弹窗开关 + isShowDesc: false, //文本域弹窗开关 + isShowPhoto: false, //图片选择弹框 + isShowLink: false, //链接弹窗 + isShowAudio: false, //录音弹窗 + isShowVideo: false, //视频弹窗 + tempText: '', + tempDesc: '', + linkStr: '', + map: null, + waitFlag: false, + isStartRecord: false, //是否录音中 + speck_time: 0, + speedStep: 5, //快进快退秒数 + setInter: '', //定时器 + currentItem: undefined, + items: [{ + title: '标题', //标题 + count: 3, //数量 + type: 'TEXT', //类型 + }, { + title: '标题', //标题 + count: 9, //数量 + type: 'TEXTAREA', //类型 + }, { + title: '标题', //标题 + count: 2, //数量 + type: 'AUDIO', //类型 + }, { + title: '标题', //标题 + count: 3, //数量 + type: 'VIDEO', //类型 + }, { + title: '标题', //标题 + count: 9, //数量 + type: 'PHOTO', //类型 + }, { + title: '标题', //标题 + count: 9, //数量 + type: 'LINK', //类型 + }, { + title: '标题', //标题 + count: 2, //数量 + type: 'LOCATION', //类型 + }], + isAuthAudio: false + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + columnId: options.id + }) + this.checkPermission() + this.getFieldList() + }, + getFieldList() { + wx.showLoading({ + title: '加载中...', + }) + var _self = this + app.http.get(app.urls.getMomentsField.format({ + configColumnId: _self.data.columnId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + fieldList: res.data + }) + }) + .catch(err => { + wx.hideLoading({}) + console.log(err) + }) + }, + //申请录音权限 + checkPermission() { + var _self = this + wx.getSetting({ + success(res) { + var isAuth = res.authSetting['scope.record'] + if (typeof (isAuth) == 'undefined') { + wx.authorize({ + scope: 'scope.record', + success() { + _self.setData({ + isAuthAudio: true + }) + }, + fail() { + _self.setData({ + isAuthAudio: false + }) + } + }) + } else { + if (!isAuth) { + _self.openSetting() + } + } + } + }) + }, + openSetting() { + wx.showModal({ + title: '提示', + content: '发布内容需要您授权录音权限.', + success(res) { + if (res.confirm) { + wx.openSetting({ + withSubscriptions: true, + }) + } + } + }) + }, + onShow() { + if (chooseLocation.getLocation() != null) { + if (this.data.locationList.length < this.data.currentItem.count) { + this.data.locationList.push(chooseLocation.getLocation()) + this.setData({ + locationList: this.data.locationList + }) + } + } + var _self = this + wx.getSetting({ + withSubscriptions: true, + success(res) { + var isAuth = res.authSetting['scope.record'] + _self.setData({ + isAuthAudio: isAuth + }) + } + }) + + }, + onUnload() { + chooseLocation.setLocation(null) + this.setData({ + map: null + }) + }, + //选择视频来源 + chooseVideo(e) { + var _self = this + var countNum = _self.data.currentItem.count - _self.data.videoList.length + console.log(countNum) + var type = e.currentTarget.dataset.type + wx.chooseMedia({ + count: Number.parseInt(countNum), + mediaType: ['video'], + sourceType: [type], + maxDuration: 60, + success: (res) => { + if (res.tempFiles.length > 0) { + _self.doUploadVideo(1, res.tempFiles, _self.data.uploadVideoCount) + } + }, + fail: (err) => { + // console.log(err) + // wx.showToast({ + // title: '选取视频失败,(拍摄时长:60秒)', + // icon: 'none' + // }) + } + }) + }, + //上传视频 + doUploadVideo(type, paths, curIndex) { + console.log(paths) + wx.showLoading({ + title: '上传中...', + }) + let _self = this + var count = paths.length //几次 + if (_self.data.uploadVideoCount < count) { + app.http.upload(app.urls.doUploadVideo, { + path: paths[_self.data.uploadVideoCount].tempFilePath, + name: 'video', + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + //插入到集合中 + var id = JSON.parse(res).data + var pathStr = app.urls.baseImgUrl + id + var item = { + id: id, + path: pathStr, + imgPath: paths[_self.data.uploadVideoCount].thumbTempFilePath + } + _self.data.videoList.push(item) + _self.setData({ + videoList: _self.data.videoList + }) + _self.setData({ + uploadVideoCount: ++_self.data.uploadVideoCount + }) + _self.doUploadVideo(1, paths, _self.data.uploadVideoCount) + }) + .catch(err => { + wx.hideLoading({}) + _self.setData({ + uploadVideoCount: ++_self.data.uploadVideoCount + }) + _self.doUploadVideo(1, paths, _self.data.uploadVideoCount) + }) + } else { + wx.hideLoading({}) + _self.setData({ + uploadVideoCount: 0 + }) + } + }, + //预览视频 + viewVideo(e) { + var tempList = [{ + url: e.currentTarget.dataset.url, + type: 'video' + }] + wx.previewMedia({ + sources: tempList, + current: 0, + showmenu: false + }) + }, + //删除视频 + delVideo(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该视频吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.videoList.splice(e.currentTarget.dataset.index, 1) + _self.setData({ + videoList: _self.data.videoList + }) + } + } + }) + }, + //添加链接 + addLink() { + var _self = this + var item = null + for (var i = 0; i < _self.data.items.length; i++) { + if (_self.data.items[i].type == 'LINK') { + item = _self.data.items[i] + break + } + } + if (_self.data.linkList.length < item.count) { + if (_self.data.linkStr == '') { + wx.showToast({ + title: '请输入文字内容', + icon: 'error' + }) + return + } + _self.data.linkList.push(_self.data.linkStr) + _self.setData({ + linkList: _self.data.linkList, + linkStr: '' + }) + if (_self.data.linkList.length == item.count) { + _self.setData({ + isShowLink: false + }) + } + } + }, + //文本域添加输入的文字 + addDesc() { + var _self = this + var item = null + for (var i = 0; i < _self.data.items.length; i++) { + if (_self.data.items[i].type == 'TEXTAREA') { + item = _self.data.items[i] + break + } + } + if (_self.data.textareaList.length < item.count) { + if (_self.data.tempDesc == '') { + wx.showToast({ + title: '请输入文字内容', + icon: 'error' + }) + return + } + _self.data.textareaList.push(_self.data.tempDesc) + _self.setData({ + textareaList: _self.data.textareaList, + tempDesc: '' + }) + if (_self.data.textareaList.length == item.count) { + _self.setData({ + isShowDesc: false + }) + } + } + }, + //添加输入的文字 + addStr() { + var _self = this + var item = null + for (var i = 0; i < _self.data.items.length; i++) { + if (_self.data.items[i].type == 'TEXT') { + item = _self.data.items[i] + break + } + } + if (_self.data.textList.length < item.count) { + if (_self.data.tempText == '') { + wx.showToast({ + title: '请输入文字内容', + icon: 'error' + }) + return + } + _self.data.textList.push(_self.data.tempText) + _self.setData({ + textList: _self.data.textList, + tempText: '' + }) + if (_self.data.textList.length == item.count) { + _self.setData({ + isShowText: false + }) + } + } + }, + //删除 + delText(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该条数据吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.textList.splice(e.currentTarget.dataset.index, 1) + this.setData({ + textList: this.data.textList + }) + } + } + }) + }, + delLink(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该条数据吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.linkList.splice(e.currentTarget.dataset.index, 1) + this.setData({ + linkList: this.data.linkList + }) + } + } + }) + }, + delDesc(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该条数据吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.textareaList.splice(e.currentTarget.dataset.index, 1) + this.setData({ + textareaList: this.data.textareaList + }) + } + } + }) + }, + //监听输入的文字 + textInput(e) { + this.setData({ + [e.currentTarget.id]: e.detail.value + }) + }, + //关闭弹窗 + onHide(e) { + this.setData({ + isShowText: false, + isShowDesc: false, + isShowPhoto: false, + isShowLink: false, + isShowAudio: false, + isShowVideo: false + }) + }, + //选择图片 + choosePhoto(e) { + var _self = this + var countNum = _self.data.currentItem.count - _self.data.photoList.length + var type = e.currentTarget.dataset.type + wx.chooseImage({ + count: Number.parseInt(countNum), + sourceType: [type], + success: (res) => { + _self.doUploadImg(1, res.tempFilePaths, _self.data.uploadCount) + }, + fail: (err) => { + + } + }) + }, + //删除图片 + delImg(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.photoList.splice(e.currentTarget.dataset.index, 1) + this.setData({ + photoList: this.data.photoList + }) + } + } + }) + }, + //预览图片 + viewImg(e) { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + doUploadImg(type, paths, curIndex) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + var count = paths.length //几次 + if (_self.data.uploadCount < count) { + app.http.upload(app.urls.doUploadImg, { + path: paths[_self.data.uploadCount], + name: 'image', + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + //插入到集合中 + var id = JSON.parse(res).data + var pathStr = app.urls.baseImgUrl + id + var item = { + id: id, + path: pathStr + } + _self.data.photoList.push(item) + _self.setData({ + photoList: _self.data.photoList + }) + _self.setData({ + uploadCount: ++_self.data.uploadCount + }) + _self.doUploadImg(1, paths, _self.data.uploadCount) + }) + .catch(err => { + wx.hideLoading({}) + _self.setData({ + uploadCount: ++_self.data.uploadCount + }) + _self.doUploadImg(1, paths, _self.data.uploadCount) + }) + } else { + wx.hideLoading({}) + _self.setData({ + uploadCount: 0 + }) + } + }, + //地图选点 + chooseLocation() { + this.data.items.forEach(it => { + if (it.type == 'LOCATION') { + this.setData({ + currentItem: it + }) + } + }) + wx.navigateTo({ + url: `plugin://chooseLocation/index?key=${key}&referer=${referer}&location=${location}&category=${category}` + }); + }, + delMap(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该条数据吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.locationList.splice(e.currentTarget.dataset.index, 1) + this.setData({ + locationList: this.data.locationList + }) + } + } + }) + }, + //删除视频 + delAudio(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该音频吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.audioList.splice(e.currentTarget.dataset.index, 1) + _self.setData({ + audioList: _self.data.audioList + }) + } + } + }) + }, + doStartRecord() { + var _self = this + wx.getSetting({ + success(res) { + if (!res.authSetting['scope.record']) { + wx.authorize({ + scope: 'scope.record', + success() { + _self.startRecord() + } + }) + } else { + _self.startRecord() + } + } + }) + }, + startRecord() { + var that = this + that.data.setInter = setInterval( + function () { + var speck_time = parseInt(that.data.speck_time + 1); + that.setData({ + speck_time: parseInt(speck_time), + isStartRecord: true + }); + if (that.data.speck_time > 0 && that.data.speck_time <= 59) { + that.start(); + } else { + clearInterval(that.data.setInter); + // 获取到结束时间 + that.stop(); + wx.showToast({ + title: '录音最长60S哦!', + duration: 2000, + icon: "none" + }) + } + }, 1000); + }, + doEndRecord() { + var _self = this; + clearInterval(_self.data.setInter); + // 获取到结束时间 + if (_self.data.speck_time > 3) { + //清除计时器 即清除setInter + clearInterval(_self.data.setInter); + // 获取到结束时间 + _self.stop(true); + _self.setData({ + speck_time: "0", + isStartRecord: false + }) + } else { + //清除计时器 即清除setInter + clearInterval(_self.data.setInter); + // 获取到结束时间 + _self.stop(false); + wx.showToast({ + title: '录制时间过短', + duration: 2000, + icon: "none" + }) + _self.setData({ + speck_time: "0", + isStartRecord: false + }) + } + }, + //开始录音的时候 + start() { + const options = { + duration: 60000, + format: 'mp3', //音频格式,有效值 aac/mp3 + } + //开始录音 + recorderManager.start(options); + recorderManager.onStart(() => { + console.log('recorder start') + }); + //错误回调 + recorderManager.onError((res) => { + console.log(res); + _self.stop(false); + }) + }, + //停止录音 + stop(success) { + var _self = this + recorderManager.stop(); + recorderManager.onStop((res) => { + if (success) { + //进行录音文件上传 + _self.doUploadAudio(res) + } + }) + }, + doUploadAudio(audio) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + app.http.upload(app.urls.doUploadAudio, { + path: audio.tempFilePath, + name: 'audio', + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + if (_self.data.audioList.length < _self.data.currentItem.count) { + wx.hideLoading({}) + //插入到集合中 + var id = JSON.parse(res).data + var pathStr = app.urls.baseImgUrl + id + //计算时长 + var dur = parseInt(audio.duration / 1000) + var tM = parseInt(dur / 60) //分钟 + var tS = parseInt(dur % 60) //秒 + var totalMStr = tM > 9 ? tM : '0' + tM + var totalSStr = +tS > 9 ? tS : '0' + tS + var totalStr = totalMStr + ':' + totalSStr + var item = { + id: id, //id + path: pathStr, //地址 + isPlay: false, //是否播放中 + duration: dur, //时长 + curDuation: 0, + curDurationStr: '00:00', + totalDurationStr: totalStr + } + _self.data.audioList.push(item) + _self.setData({ + audioList: _self.data.audioList + }) + console.log(_self.data.audioList) + if (_self.data.audioList.length == _self.data.currentItem.count) { + _self.setData({ + isShowAudio: false + }) + } + } + }) + .catch(err => {}) + }, + play(e) { + + //进行播放 + var index = e.currentTarget.dataset.index + var item = e.currentTarget.dataset.item + var _self = this + _self.data.audioList.forEach(it => { + if (it.isPlay) { + innerAudioContext.stop() + } + it.isPlay = false + it.curDuation = 0 + it.curDuationStr = '00:00' + }) + if (!item.isPlay) { + // innerAudioContext.stop() + //找到该文件 + innerAudioContext = wx.createInnerAudioContext() + // 播放音频文件 + innerAudioContext.src = _self.data.audioList[index].path + innerAudioContext.autoplay = true + } + //先需要停止其他录音文件的播放 + + innerAudioContext.onPlay(() => { + _self.data.audioList[index].isPlay = true + _self.setData({ + audioList: _self.data.audioList + }) + }); + + innerAudioContext.onCanplay((res) => { + if (_self.data.waitFlag) { + innerAudioContext.play() + _self.setData({ + waitFlag: false + }) + } + }) + innerAudioContext.onStop((res) => { + _self.data.audioList[index].isPlay = false + _self.data.audioList[index].curDuration = 0 + _self.data.audioList[index].curDurationStr = '00:00' + _self.setData({ + audioList: _self.data.audioList, + }) + }) + innerAudioContext.onEnded((res) => { + _self.data.audioList[index].isPlay = false + _self.data.audioList[index].curDuration = 0 + _self.data.audioList[index].curDurationStr = '00:00' + _self.setData({ + audioList: _self.data.audioList, + }) + }) + innerAudioContext.onError((res) => { + _self.data.audioList[index].isPlay = false + _self.data.audioList[index].curDuration = 0 + _self.data.audioList[index].curDurationStr = '00:00' + _self.setData({ + audioList: _self.data.audioList, + }) + }) + innerAudioContext.onSeeking(() => { + console.log(innerAudioContext.currentTime) + }) + innerAudioContext.onWaiting(() => { + innerAudioContext.pause() + _self.setData({ + waitFlag: true + }) + }) + innerAudioContext.onTimeUpdate(() => { + if (innerAudioContext.duration != Infinity) { + _self.data.audioList[index].curDuration = parseInt(innerAudioContext.currentTime) + _self.data.audioList[index].duration = parseInt(innerAudioContext.duration) + console.log(innerAudioContext.duration) + var curM = parseInt(innerAudioContext.currentTime / 60) //分钟 + var curS = parseInt(innerAudioContext.currentTime % 60) //秒 + var tM = parseInt(innerAudioContext.duration / 60) //分钟 + var tS = parseInt(innerAudioContext.duration % 60) //秒 + var curMStr = curM > 9 ? curM : '0' + curM + var curSStr = curS > 9 ? curS : '0' + curS + var totalMStr = tM > 9 ? tM : '0' + tM + var totalSStr = +tS > 9 ? tS : '0' + tS + _self.data.audioList[index].curDurationStr = curMStr + ':' + curSStr + _self.data.audioList[index].totalDurationStr = totalMStr + ':' + totalSStr + _self.setData({ + audioList: _self.data.audioList + }) + } + }) + }, + //倒退5秒 + rewind(e) { + var _self = this + var index = e.currentTarget.dataset.index + var item = e.currentTarget.dataset.item + if (item.isPlay) { + _self.data.audioList[index].curDuration = _self.data.audioList[index].curDuration - _self.data.speedStep + innerAudioContext.seek(_self.data.audioList[index].curDuration) + _self.setData({ + audioList: _self.data.audioList + }) + } + + }, + //快进5秒 + speed(e) { + var _self = this + var index = e.currentTarget.dataset.index + var item = e.currentTarget.dataset.item + if (item.isPlay) { + _self.data.audioList[index].curDuration = _self.data.audioList[index].curDuration + _self.data.speedStep + innerAudioContext.seek(_self.data.audioList[index].curDuration) + _self.setData({ + audioList: _self.data.audioList + }) + } + }, + slider4change(e) { + var index = e.currentTarget.dataset.index + var item = e.currentTarget.dataset.item + if (item.isPlay) { + innerAudioContext.seek(e.detail.value) + } + }, + //显示弹框 + showDialog(e) { + var type = e.currentTarget.dataset.type + var keyType = e.currentTarget.dataset.keytype + console.log(e) + this.data.items.forEach(it => { + if (it.type == type) { + this.setData({ + currentItem: it + }) + return + } + }) + this.setData({ + [keyType]: true + }) + } +}) \ No newline at end of file diff --git a/pages/moments/publish/momentpublish.json b/pages/moments/publish/momentpublish.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/moments/publish/momentpublish.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/moments/publish/momentpublish.wxml b/pages/moments/publish/momentpublish.wxml new file mode 100644 index 0000000..17678c1 --- /dev/null +++ b/pages/moments/publish/momentpublish.wxml @@ -0,0 +1,325 @@ + + 内容发布 + + + + + + + + + {{item.comment}} + + + + + + {{txt}} + + + + + + + + + + 用一段话,向名片访客介绍自己吧 + + + + 点击添加 + + + + + + + {{item.comment}} + + + + + + {{txt}} + + + + + + + + + + 用一段话,向名片访客介绍自己吧 + + + 点击添加 + + + + + + + {{item.comment}} + + + + {{'数量'+'('+photoList.length+'/'+ currentItem.maxCount+')'}} + + + + + + + + + + + + + + + + 用一段话,向名片访客介绍自己吧 + + + 点击添加 + + + + + + + {{item.comment}} + + + + + + + + + {{audio.curDurationStr}} + + {{audio.totalDurationStr}} + + + + + + + + + + + + + + + + + + + 语音,可以给名片访客留下更深的印象 + + + 点击添加 + + + + + + + {{item.comment}} + + + + {{'数量'+'('+videoList.length+'/'+ currentItem.maxCount+')'}} + + + + + + + + + + + + + + + + 用一段话,向名片访客介绍自己吧 + + + 点击添加 + + + + + + + + {{item.comment}} + + + + + + {{txt}} + + + + + + + + + + 用一段话,向名片访客介绍自己吧 + + + + 点击添加 + + + + + + + {{item.comment}} + + + + + + + {{m.name}}-{{m.address}} + + + + + + + + + + + + + + + 在地图上选取一个地点 + + + + 点击添加 + + + + + + + + + + + + + + 00:{{speck_time>9 ? speck_time : '0'+ speck_time}} + 长按录音 + + + + + {{audioFile.isPlay ? '播放中:'+speck_time+'秒' : '时长:'+audioFile.duration+'秒'}} + + 点击播放 + 删除 + + + + + + + + 点击添加 + + + + + + + 点击添加 + + + + + + + 相册 + + + 相机 + + + + + + + + 相册 + + + 相机 + + + + + + + + + 点击添加 + + \ No newline at end of file diff --git a/pages/moments/publish/momentpublish.wxss b/pages/moments/publish/momentpublish.wxss new file mode 100644 index 0000000..b904865 --- /dev/null +++ b/pages/moments/publish/momentpublish.wxss @@ -0,0 +1,49 @@ +/* pages/moments/publish/momentpublish.wxss */ + + +van-action-sheet input { + border: 1px solid rgb(194, 194, 194); + border-radius: 10rpx; + height: 60rpx; + line-height: 60rpx; + margin-top: 9rpx; + padding-left: 10rpx; +} + +van-action-sheet textarea { + border: 1px solid rgb(194, 194, 194); + border-radius: 10rpx; + margin-top: 9rpx; + padding: 10rpx; +} + +van-action-sheet .line { + height: 90rpx; + text-align: center; + line-height: 90rpx; + width: 90%; + border-top-width: 1rpx; + border-top-color: #f5f5f5; + border-top-style: solid; + border-bottom-width: 1rpx; + border-bottom-color: #f5f5f5; + border-bottom-style: solid; +} + +van-action-sheet .noline { + height: 90rpx; + text-align: center; + line-height: 90rpx; + width: 90%; +} + + +van-action-sheet .line:active { + color: black; + background-color: #f5f5f5; +} + +van-action-sheet .noline:active { + color: black; + background-color: #f5f5f5; +} \ No newline at end of file diff --git a/pages/moments/publish/momentpublishline.js b/pages/moments/publish/momentpublishline.js new file mode 100644 index 0000000..e781821 --- /dev/null +++ b/pages/moments/publish/momentpublishline.js @@ -0,0 +1,847 @@ +const app = getApp() +const recorderManager = wx.getRecorderManager() +var innerAudioContext = wx.createInnerAudioContext() +const chooseLocation = requirePlugin('chooseLocation'); +const key = 'Y6FBZ-GLQC3-6273Q-3DRTL-W43G5-G6BXN'; //使用在腾讯位置服务申请的key +const referer = '名片-小程序'; //调用插件的app的名称 +const location = JSON.stringify({ + latitude: 39.89631551, + longitude: 116.323459711 +}); +const category = '生活服务,娱乐休闲'; +Page({ + + /** + * 页面的初始数据 + */ + data: { + uploadCount: 0, + uploadVideoCount: 0, + currentIndex: 0, + columnId: '', //栏目Id + fieldList: [], //栏目字段 + textList: [], //文本添加内容 + textareaList: [], //文本域添加内容 + audioList: [], //音频添加内容 + videoList: [], //视频添加内容 + photoList: [], //视频添加内容 + linkList: [], //连接添加内容 + locationList: [], //定位添加内容 + isShowText: false, //文本弹窗开关 + isShowDesc: false, //文本域弹窗开关 + isShowPhoto: false, //图片选择弹框 + isShowLink: false, //链接弹窗 + isShowAudio: false, //录音弹窗 + isShowVideo: false, //视频弹窗 + tempText: '', + tempDesc: '', + linkStr: '', + map: null, + waitFlag: false, + isStartRecord: false, //是否录音中 + speck_time: 0, + speedStep: 5, //快进快退秒数 + setInter: '', //定时器 + currentItem: undefined, + isAuthAudio: false + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + columnId: options.id + }) + this.checkPermission() + this.getFieldList() + }, + getFieldList() { + wx.showLoading({ + title: '加载中...', + }) + var _self = this + app.http.get(app.urls.getMomentsField.format({ + configColumnId: _self.data.columnId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + res.data.forEach(it => { + // 2:照片,3:音频,4:视频,5:链接,6:定位 + switch (it.dataType) { + case '2': + case '3': + case '4': + case '5': + case '6': + it.valueList = [] + break + } + }) + _self.setData({ + fieldList: res.data + }) + }) + .catch(err => { + wx.hideLoading({}) + console.log(err) + }) + }, + inputText(e) { + var index = e.currentTarget.dataset.index + var _self = this + _self.data.fieldList[index].value = e.detail.value + _self.setData({ + fieldList: _self.data.fieldList + }) + }, + //申请录音权限 + checkPermission() { + var _self = this + wx.getSetting({ + success(res) { + var isAuth = res.authSetting['scope.record'] + if (typeof (isAuth) == 'undefined') { + wx.authorize({ + scope: 'scope.record', + success() { + _self.setData({ + isAuthAudio: true + }) + }, + fail() { + _self.setData({ + isAuthAudio: false + }) + } + }) + } else { + if (!isAuth) { + _self.openSetting() + } + } + } + }) + }, + openSetting() { + wx.showModal({ + title: '提示', + content: '发布内容需要您授权录音权限.', + success(res) { + if (res.confirm) { + wx.openSetting({ + withSubscriptions: true, + }) + } + } + }) + }, + onShow() { + if (chooseLocation.getLocation() != null) { + if (this.data.locationList.length < this.data.currentItem.count) { + this.data.locationList.push(chooseLocation.getLocation()) + this.setData({ + locationList: this.data.locationList + }) + } + } + var _self = this + wx.getSetting({ + withSubscriptions: true, + success(res) { + var isAuth = res.authSetting['scope.record'] + _self.setData({ + isAuthAudio: isAuth + }) + } + }) + + }, + onUnload() { + chooseLocation.setLocation(null) + this.setData({ + map: null + }) + }, + //选择视频来源 + chooseVideo(e) { + var _self = this + var item = e.currentTarget.dataset.item + var countNum = item.maxCount - item.valueList.length + var index = e.currentTarget.dataset.index + wx.chooseMedia({ + count: Number.parseInt(countNum), + mediaType: ['video'], + sourceType: ['camera', 'album'], + maxDuration: 60, + success: (res) => { + if (res.tempFiles.length > 0) { + _self.doUploadVideo(index, res.tempFiles, _self.data.uploadVideoCount) + } + }, + fail: (err) => { + // console.log(err) + // wx.showToast({ + // title: '选取视频失败,(拍摄时长:60秒)', + // icon: 'none' + // }) + } + }) + }, + //上传视频 + doUploadVideo(index, paths, curIndex) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + var count = paths.length //几次 + if (_self.data.uploadVideoCount < count) { + app.http.upload(app.urls.doUploadVideo, { + path: paths[_self.data.uploadVideoCount].tempFilePath, + name: 'video', + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + //插入到集合中 + var id = JSON.parse(res).data + var pathStr = app.urls.baseImgUrl + id + var item = { + id: id, + path: pathStr, + imgPath: paths[_self.data.uploadVideoCount].thumbTempFilePath + } + _self.data.fieldList[index].valueList.push(item) + _self.setData({ + fieldList: _self.data.fieldList + }) + _self.setData({ + uploadVideoCount: ++_self.data.uploadVideoCount + }) + _self.doUploadVideo(index, paths, _self.data.uploadVideoCount) + }) + .catch(err => { + wx.hideLoading({}) + _self.setData({ + uploadVideoCount: ++_self.data.uploadVideoCount + }) + _self.doUploadVideo(1, paths, _self.data.uploadVideoCount) + }) + } else { + wx.hideLoading({}) + _self.setData({ + uploadVideoCount: 0 + }) + } + }, + //预览视频 + viewVideo(e) { + var tempList = [{ + url: e.currentTarget.dataset.url, + type: 'video' + }] + wx.previewMedia({ + sources: tempList, + current: 0, + showmenu: false + }) + }, + //删除视频 + delVideo(e) { + let _self = this + var index = e.currentTarget.dataset.index + var idx = e.currentTarget.dataset.idx + wx.showModal({ + title: '提示', + content: '确定要删除该视频吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.fieldList[index].valueList.splice(idx, 1) + _self.setData({ + fieldList: _self.data.fieldList + }) + } + } + }) + }, + //添加链接 + addLink() { + var _self = this + var item = null + for (var i = 0; i < _self.data.items.length; i++) { + if (_self.data.items[i].type == 'LINK') { + item = _self.data.items[i] + break + } + } + if (_self.data.linkList.length < item.count) { + if (_self.data.linkStr == '') { + wx.showToast({ + title: '请输入文字内容', + icon: 'error' + }) + return + } + _self.data.linkList.push(_self.data.linkStr) + _self.setData({ + linkList: _self.data.linkList, + linkStr: '' + }) + if (_self.data.linkList.length == item.count) { + _self.setData({ + isShowLink: false + }) + } + } + }, + //文本域添加输入的文字 + addDesc() { + var _self = this + var item = null + for (var i = 0; i < _self.data.items.length; i++) { + if (_self.data.items[i].type == 'TEXTAREA') { + item = _self.data.items[i] + break + } + } + if (_self.data.textareaList.length < item.count) { + if (_self.data.tempDesc == '') { + wx.showToast({ + title: '请输入文字内容', + icon: 'error' + }) + return + } + _self.data.textareaList.push(_self.data.tempDesc) + _self.setData({ + textareaList: _self.data.textareaList, + tempDesc: '' + }) + if (_self.data.textareaList.length == item.count) { + _self.setData({ + isShowDesc: false + }) + } + } + }, + //添加输入的文字 + addStr() { + var _self = this + var item = null + for (var i = 0; i < _self.data.items.length; i++) { + if (_self.data.items[i].type == 'TEXT') { + item = _self.data.items[i] + break + } + } + if (_self.data.textList.length < item.count) { + if (_self.data.tempText == '') { + wx.showToast({ + title: '请输入文字内容', + icon: 'error' + }) + return + } + _self.data.textList.push(_self.data.tempText) + _self.setData({ + textList: _self.data.textList, + tempText: '' + }) + if (_self.data.textList.length == item.count) { + _self.setData({ + isShowText: false + }) + } + } + }, + //删除 + delText(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该条数据吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.textList.splice(e.currentTarget.dataset.index, 1) + this.setData({ + textList: this.data.textList + }) + } + } + }) + }, + delLink(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该条数据吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.linkList.splice(e.currentTarget.dataset.index, 1) + this.setData({ + linkList: this.data.linkList + }) + } + } + }) + }, + delDesc(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该条数据吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.textareaList.splice(e.currentTarget.dataset.index, 1) + this.setData({ + textareaList: this.data.textareaList + }) + } + } + }) + }, + //监听输入的文字 + textInput(e) { + this.setData({ + [e.currentTarget.id]: e.detail.value + }) + }, + //关闭弹窗 + onHide(e) { + this.setData({ + isShowText: false, + isShowDesc: false, + isShowPhoto: false, + isShowLink: false, + isShowAudio: false, + isShowVideo: false + }) + }, + //选择图片 + choosePhoto(e) { + var _self = this + var item = e.currentTarget.dataset.item + var index = e.currentTarget.dataset.index + var countNum = item.maxCount - item.valueList.length + + wx.chooseImage({ + count: Number.parseInt(countNum), + sourceType: ['album', 'camera'], + success: (res) => { + _self.doUploadImg(index, res.tempFilePaths, _self.data.uploadCount) + }, + fail: (err) => { + + } + }) + }, + //删除图片 + delImg(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.fieldList[e.currentTarget.dataset.itemindex].valueList.splice(e.currentTarget.dataset.index, 1) + this.setData({ + fieldList: this.data.fieldList + }) + } + } + }) + }, + //预览图片 + viewImg(e) { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + doUploadImg(index, paths, curIndex) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + var count = paths.length //几次 + if (_self.data.uploadCount < count) { + app.http.upload(app.urls.doUploadImg, { + path: paths[_self.data.uploadCount], + name: 'image', + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + //插入到集合中 + var id = JSON.parse(res).data + var pathStr = app.urls.baseImgUrl + id + var item = { + id: id, + path: pathStr + } + _self.data.fieldList[index].valueList.push(item) + _self.setData({ + fieldList: _self.data.fieldList + }) + _self.setData({ + uploadCount: ++_self.data.uploadCount + }) + _self.doUploadImg(index, paths, _self.data.uploadCount) + }) + .catch(err => { + wx.hideLoading({}) + _self.setData({ + uploadCount: ++_self.data.uploadCount + }) + _self.doUploadImg(index, paths, _self.data.uploadCount) + }) + } else { + wx.hideLoading({}) + _self.setData({ + uploadCount: 0 + }) + } + }, + //地图选点 + chooseLocation() { + var index = e.currentTarget.dataset.index + this.setData({ + curMapIndex: index + }) + wx.navigateTo({ + url: `plugin://chooseLocation/index?key=${key}&referer=${referer}&location=${location}&category=${category}` + }); + }, + delMap(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该条数据吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.locationList.splice(e.currentTarget.dataset.index, 1) + this.setData({ + locationList: this.data.locationList + }) + } + } + }) + }, + //删除视频 + delAudio(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该音频吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.audioList.splice(e.currentTarget.dataset.index, 1) + _self.setData({ + audioList: _self.data.audioList + }) + } + } + }) + }, + doStartRecord() { + var _self = this + wx.getSetting({ + success(res) { + if (!res.authSetting['scope.record']) { + wx.authorize({ + scope: 'scope.record', + success() { + _self.startRecord() + } + }) + } else { + _self.startRecord() + } + } + }) + }, + startRecord() { + var that = this + that.data.setInter = setInterval( + function () { + var speck_time = parseInt(that.data.speck_time + 1); + that.setData({ + speck_time: parseInt(speck_time), + isStartRecord: true + }); + if (that.data.speck_time > 0 && that.data.speck_time <= 59) { + that.start(); + } else { + clearInterval(that.data.setInter); + // 获取到结束时间 + that.stop(); + wx.showToast({ + title: '录音最长60S哦!', + duration: 2000, + icon: "none" + }) + } + }, 1000); + }, + doEndRecord() { + var _self = this; + clearInterval(_self.data.setInter); + // 获取到结束时间 + if (_self.data.speck_time > 3) { + //清除计时器 即清除setInter + clearInterval(_self.data.setInter); + // 获取到结束时间 + _self.stop(true); + _self.setData({ + speck_time: "0", + isStartRecord: false + }) + } else { + //清除计时器 即清除setInter + clearInterval(_self.data.setInter); + // 获取到结束时间 + _self.stop(false); + wx.showToast({ + title: '录制时间过短', + duration: 2000, + icon: "none" + }) + _self.setData({ + speck_time: "0", + isStartRecord: false + }) + } + }, + //开始录音的时候 + start() { + const options = { + duration: 60000, + format: 'mp3', //音频格式,有效值 aac/mp3 + } + //开始录音 + recorderManager.start(options); + recorderManager.onStart(() => { + console.log('recorder start') + }); + //错误回调 + recorderManager.onError((res) => { + console.log(res); + _self.stop(false); + }) + }, + //停止录音 + stop(success) { + var _self = this + recorderManager.stop(); + recorderManager.onStop((res) => { + if (success) { + //进行录音文件上传 + _self.doUploadAudio(res) + } + }) + }, + doUploadAudio(audio) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + app.http.upload(app.urls.doUploadAudio, { + path: audio.tempFilePath, + name: 'audio', + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + if (_self.data.fieldList[_self.data.currentIndex].valueList.length < _self.data.currentItem.maxCount) { + wx.hideLoading({}) + //插入到集合中 + var id = JSON.parse(res).data + var pathStr = app.urls.baseImgUrl + id + //计算时长 + var dur = parseInt(audio.duration / 1000) + var tM = parseInt(dur / 60) //分钟 + var tS = parseInt(dur % 60) //秒 + var totalMStr = tM > 9 ? tM : '0' + tM + var totalSStr = +tS > 9 ? tS : '0' + tS + var totalStr = totalMStr + ':' + totalSStr + var item = { + id: id, //id + path: pathStr, //地址 + isPlay: false, //是否播放中 + duration: dur, //时长 + curDuation: 0, + curDurationStr: '00:00', + totalDurationStr: totalStr + } + _self.data.fieldList[_self.data.currentIndex].valueList.push(item) + _self.setData({ + fieldList: _self.data.fieldList + }) + if (_self.data.fieldList[_self.data.currentIndex].valueList == _self.data.currentItem.maxCount) { + _self.setData({ + isShowAudio: false + }) + } + } + }) + .catch(err => {}) + }, + play(e) { + + //进行播放 + var index = e.currentTarget.dataset.index + var idx = e.currentTarget.dataset.idx + var item = e.currentTarget.dataset.item + var _self = this + _self.data.fieldList[index].valueList.forEach(it => { + if (it.isPlay) { + innerAudioContext.stop() + } + it.isPlay = false + it.curDuation = 0 + it.curDuationStr = '00:00' + }) + if (!item.isPlay) { + // innerAudioContext.stop() + //找到该文件 + innerAudioContext = wx.createInnerAudioContext() + // 播放音频文件 + innerAudioContext.src = _self.data.fieldList[index].valueList[idx].path + innerAudioContext.autoplay = true + } + //先需要停止其他录音文件的播放 + + innerAudioContext.onPlay(() => { + _self.data.fieldList[index].valueList[idx].isPlay = true + _self.setData({ + fieldList: _self.data.fieldList + }) + }); + + innerAudioContext.onCanplay((res) => { + if (_self.data.waitFlag) { + innerAudioContext.play() + _self.setData({ + waitFlag: false + }) + } + }) + innerAudioContext.onStop((res) => { + _self.data.fieldList[index].valueList[idx].isPlay = false + _self.data.fieldList[index].valueList[idx].curDuration = 0 + _self.data.fieldList[index].valueList[idx].curDurationStr = '00:00' + _self.setData({ + fieldList: _self.data.fieldList, + }) + }) + innerAudioContext.onEnded((res) => { + _self.data.fieldList[index].valueList[idx].isPlay = false + _self.data.fieldList[index].valueList[idx].curDuration = 0 + _self.data.fieldList[index].valueList[idx].curDurationStr = '00:00' + _self.setData({ + fieldList: _self.data.fieldList, + }) + }) + innerAudioContext.onError((res) => { + _self.data.fieldList[index].valueList[idx].isPlay = false + _self.data.fieldList[index].valueList[idx].curDuration = 0 + _self.data.fieldList[index].valueList[idx].curDurationStr = '00:00' + _self.setData({ + fieldList: _self.data.fieldList, + }) + }) + innerAudioContext.onSeeking(() => { + console.log(innerAudioContext.currentTime) + }) + innerAudioContext.onWaiting(() => { + innerAudioContext.pause() + _self.setData({ + waitFlag: true + }) + }) + innerAudioContext.onTimeUpdate(() => { + if (innerAudioContext.duration != Infinity) { + _self.data.fieldList[index].valueList[idx].curDuration = parseInt(innerAudioContext.currentTime) + _self.data.fieldList[index].valueList[idx].duration = parseInt(innerAudioContext.duration) + console.log(innerAudioContext.duration) + var curM = parseInt(innerAudioContext.currentTime / 60) //分钟 + var curS = parseInt(innerAudioContext.currentTime % 60) //秒 + var tM = parseInt(innerAudioContext.duration / 60) //分钟 + var tS = parseInt(innerAudioContext.duration % 60) //秒 + var curMStr = curM > 9 ? curM : '0' + curM + var curSStr = curS > 9 ? curS : '0' + curS + var totalMStr = tM > 9 ? tM : '0' + tM + var totalSStr = +tS > 9 ? tS : '0' + tS + _self.data.fieldList[index].valueList[idx].curDurationStr = curMStr + ':' + curSStr + _self.data.fieldList[index].valueList[idx].totalDurationStr = totalMStr + ':' + totalSStr + _self.setData({ + fieldList: _self.data.fieldList + }) + } + }) + }, + //倒退5秒 + rewind(e) { + var _self = this + var index = e.currentTarget.dataset.index + var idx = e.currentTarget.dataset.idx + var item = e.currentTarget.dataset.item + if (item.isPlay) { + _self.data.fieldList[index].valueList[idx].curDuration = _self.data.fieldList[index].valueList[idx].curDuration - _self.data.speedStep + innerAudioContext.seek(_self.data.fieldList[index].valueList[idx].curDuration) + _self.setData({ + fieldList: _self.data.fieldList + }) + } + + }, + //快进5秒 + speed(e) { + var index = e.currentTarget.dataset.index + var idx = e.currentTarget.dataset.idx + var item = e.currentTarget.dataset.item + var _self = this + if (item.isPlay) { + _self.data.fieldList[index].valueList[idx].curDuration = _self.data.fieldList[index].valueList[idx].curDuration + _self.data.speedStep + innerAudioContext.seek(_self.data.fieldList[index].valueList[idx].curDuration) + _self.setData({ + fieldList: _self.data.fieldList + }) + } + }, + slider4change(e) { + var item = e.currentTarget.dataset.item + if (item.isPlay) { + innerAudioContext.seek(e.detail.value) + } + }, + //显示弹框 + showDialog(e) { + console.log(e) + this.setData({ + isShowAudio: true, + currentItem: e.currentTarget.dataset.item, + currentIndex: e.currentTarget.dataset.index + }) + } +}) \ No newline at end of file diff --git a/pages/moments/publish/momentpublishline.json b/pages/moments/publish/momentpublishline.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/moments/publish/momentpublishline.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/moments/publish/momentpublishline.wxml b/pages/moments/publish/momentpublishline.wxml new file mode 100644 index 0000000..0e7cdaa --- /dev/null +++ b/pages/moments/publish/momentpublishline.wxml @@ -0,0 +1,270 @@ + + 内容发布 + + + + + + + + + {{item.comment}} + + + + + + + + {{item.comment}} + + + + + + + + + + + + + {{item.comment}} + + + {{item.valueList.length}}/{{item.maxCount}} + + + + + + + + + + + + + + + + + + + + + {{item.comment}} + + + {{item.valueList.length}}/{{item.maxCount}} + + + + + + + + + + {{audio.curDurationStr}} + + {{audio.totalDurationStr}} + + + + + + + + + + + + + + + + + + + 语音,可以给名片访客留下更深的印象 + + + 点击添加 + + + + + + + + {{item.comment}} + + + {{item.valueList.length}}/{{item.maxCount}} + + + + + + + + + + + + + + + + + + + + {{item.comment}} + + + + + + + + {{item.comment}} + + + + + + + + + + {{m.name}}-{{m.address}} + + + + + + + + + + + + + + + 在地图上选取一个地点 + + + 点击添加 + + + + + + + + + + + + + + + + + + 00:{{speck_time>9 ? speck_time : '0'+ speck_time}} + 长按录音 + + + + + {{audioFile.isPlay ? '播放中:'+speck_time+'秒' : '时长:'+audioFile.duration+'秒'}} + + 点击播放 + 删除 + + + + + + + + 点击添加 + + + + + + + 点击添加 + + + + + + + 相册 + + + 相机 + + + + + + + + 相册 + + + 相机 + + + + + + + + + 点击添加 + + \ No newline at end of file diff --git a/pages/moments/publish/momentpublishline.wxss b/pages/moments/publish/momentpublishline.wxss new file mode 100644 index 0000000..b904865 --- /dev/null +++ b/pages/moments/publish/momentpublishline.wxss @@ -0,0 +1,49 @@ +/* pages/moments/publish/momentpublish.wxss */ + + +van-action-sheet input { + border: 1px solid rgb(194, 194, 194); + border-radius: 10rpx; + height: 60rpx; + line-height: 60rpx; + margin-top: 9rpx; + padding-left: 10rpx; +} + +van-action-sheet textarea { + border: 1px solid rgb(194, 194, 194); + border-radius: 10rpx; + margin-top: 9rpx; + padding: 10rpx; +} + +van-action-sheet .line { + height: 90rpx; + text-align: center; + line-height: 90rpx; + width: 90%; + border-top-width: 1rpx; + border-top-color: #f5f5f5; + border-top-style: solid; + border-bottom-width: 1rpx; + border-bottom-color: #f5f5f5; + border-bottom-style: solid; +} + +van-action-sheet .noline { + height: 90rpx; + text-align: center; + line-height: 90rpx; + width: 90%; +} + + +van-action-sheet .line:active { + color: black; + background-color: #f5f5f5; +} + +van-action-sheet .noline:active { + color: black; + background-color: #f5f5f5; +} \ No newline at end of file diff --git a/project.config.json b/project.config.json index 3c739b6..acac863 100644 --- a/project.config.json +++ b/project.config.json @@ -40,7 +40,7 @@ }, "compileType": "miniprogram", "libVersion": "2.17.0", - "appid": "wx501e9ce64f25c418", + "appid": "wxe17874894f7ff27b", "projectname": "card", "debugOptions": { "hidedInDevtools": [] diff --git a/utils/api.js b/utils/api.js index 93807bb..4c7a070 100644 --- a/utils/api.js +++ b/utils/api.js @@ -1,8 +1,14 @@ var apis = { - url: 'https://www.wgink.ink/businesscard/', - userCenter: 'https://192.168.0.103:7001/usercenter/', - cardUrl: 'https://www.wgink.ink/businesscard/', - baseImgUrl: 'https://www.wgink.ink/businesscard/route/file/download/true/', + url: 'http://192.168.0.115:8091/systemcard/', + userCenter: 'http://192.168.0.115:8091/systemcard/', + baseImgUrl: 'http://192.168.0.115:8091/systemcard/route/file/download/true/', + doUploadImg: `app/file/uploadimage`, //上传图片 + doUploadVideo: `app/file/uploadvideo`, //上传视频 + doUploadAudio: `app/file/uploadaudio`, //上传音频 + /**用户相关 */ + wxLogin: `wechat/miniapp/sign/default`, //微信用户登录 + /**个人中心 */ + getMenuList: `app/configcolumngroup/list`, /**店铺相关 **/ doSaveShop: `app/shop/save`, //保存商店 doUpdateShopInfo: `app/shop/updateshop/{shopId}`, //更新店铺信息 @@ -40,25 +46,12 @@ var apis = { doSaveOrder: `app/orderdetail/save`, //提交订单 POST getMineOrderList: `app/order/listpageorder`, //我的订单列表 getOrderDetail: `app/order/get/{orderId}`, //获取订单详情 - doUploadImg: `app/file/uploadimage`, //上传图片 - doUploadVideo: `app/file/uploadvideo`, //上传视频 - doUploadAudio: `app/file/uploadaudio`, //上传音频 + //个人中心列表 - getMenuList: `app/menuconfig/list-ztree`, //获取个人中心菜单 - getButtonConfig: `app/menuconfig/get-button-config`, //判断是否显示发布按钮 - getMomentsCatelogList: `app/columnmng/list`, //获取栏目列表 - doSaveMomentsCagelog: `app/usercolumn/save-more`, //保存选择的栏目 - getMineMomentsCategoryList: `app/usercolumn/list-by-creator-title`, //获取自己选中的栏目 - doDelMineCategory: `app/usercolumn/remove/{ids}`, //删除自己选中的栏目 - getColumnDetail: `app/usercolumn/get/{userColumnId}`, //获取栏目详情 - getMineMomentsList: `app/usercolumndata/listpageusercolumndata`, //获取栏目内容列表 - doSaveMoments: `app/usercolumndata/save`, //保存 - doUpdateMoments: `app/usercolumndata/update/{userColumnDataId}`, //更新发布的内容 - getMomentsDetail: `app/usercolumndata/get/{userColumnDataId}`, //获取栏目内容详情 - getHomeData: `app/usercolumndata/list-my-creator`, //获取首页栏目数据 - getShareUserMoment: `app/usercolumndata/list-my-creator-id/{userId}`, //获取分享首页数据 - getShareMomentList: `app/usercolumndata/list-page-by-userId`, //获取分享栏目更多列表 - doDelMoment: `app/usercolumndata/delete/{ids}`, //删除栏目数据 + //栏目数据 + getMomentsList: `app/configcolumndata/listrelease/{configColumnId}`, //获取栏目数据列表 + doSaveMoments: `app/configcolumndata/saverelease/{configColumnId}`, //保存栏目数据 + getMomentsField: `app/configcolumndata/listfieldrelease/{configColumnId}`, //获取栏目字段列表 } module.exports = { diff --git a/utils/request.js b/utils/request.js index c913210..ded8877 100644 --- a/utils/request.js +++ b/utils/request.js @@ -107,8 +107,8 @@ function doAjax(url, method, args) { } else { errorback(res) var hintMsg = '网络错误' - if (res.msg) { - hintMsg += ',' + res.msg + if (res.data.msg) { + hintMsg = res.data.msg } wx.showToast({ title: hintMsg, @@ -117,14 +117,14 @@ function doAjax(url, method, args) { } }, fail: err => { - errorback(res) wx.hideLoading({}) + errorback(err) var hintMsg = '网络错误' - if (err.msg) { - hintMsg += ',' + err.msg + if (err.data.msg) { + hintMsg = err.data.msg } wx.showToast({ - title: hintMsg, + title: hintMsg + '(100)', icon: 'error' }) }, @@ -241,6 +241,68 @@ function postFile(url, path, name, args, successCallback, errorCallback, complet } }) }; +/** + * Promise 上传文件 + */ +function upload(url, params) { + return new Promise((success, errorback) => { + var requestUrl = api.apis.url + url + wx.uploadFile({ + filePath: params.path, + name: params.name, + url: requestUrl, + header: params.header, + success: function (response) { + console.log('success') + if (response.statusCode == 200) { + success(response.data); + } else { + errorback(response) + if (typeof (response.data) != undefined) { + try { + var data = JSON.parse(response.data) + wx.showToast({ + title: data.msg, + icon: 'none' + }) + } catch (err) { + wx.showToast({ + title: '网络错误', + icon: 'error' + }) + } + } else { + wx.showToast({ + title: '网络错误', + icon: 'error' + }) + } + } + }, + fail: function (response) { + wx.hideLoading({}) + try { + if (typeof (response.data.msg) != undefined) { + wx.showToast({ + title: response.data.msg, + icon: 'none' + }) + } else { + wx.showToast({ + title: '网络错误(100)', + icon: 'error' + }) + } + } catch (err) { + wx.showToast({ + title: '网络错误(100)', + icon: 'error' + }) + } + } + }) + }) +} /** * xss 转义 @@ -272,5 +334,6 @@ module.exports = { path: buildPath, escape: escape, file: postFile, + upload: upload, apis: api.apis } \ No newline at end of file diff --git a/vant/dist/icon/index.wxss b/vant/dist/icon/index.wxss index 2d5f879..54e41be 100644 --- a/vant/dist/icon/index.wxss +++ b/vant/dist/icon/index.wxss @@ -1 +1,1001 @@ -@import '../common/index.wxss';@font-face{font-weight:400;font-family:vant-icon;font-style:normal;font-display:auto;src:url(https://img01.yzcdn.cn/vant/vant-icon-f463a9.woff2) format("woff2"),url(https://img01.yzcdn.cn/vant/vant-icon-f463a9.woff) format("woff"),url(https://img01.yzcdn.cn/vant/vant-icon-f463a9.ttf) format("truetype")}.van-icon{position:relative;font:normal normal normal 14px/1 vant-icon;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased}.van-icon,.van-icon:before{display:inline-block}.van-icon-add-o:before{content:"\F000"}.van-icon-add-square:before{content:"\F001"}.van-icon-add:before{content:"\F002"}.van-icon-after-sale:before{content:"\F003"}.van-icon-aim:before{content:"\F004"}.van-icon-alipay:before{content:"\F005"}.van-icon-apps-o:before{content:"\F006"}.van-icon-arrow-down:before{content:"\F007"}.van-icon-arrow-left:before{content:"\F008"}.van-icon-arrow-up:before{content:"\F009"}.van-icon-arrow:before{content:"\F00A"}.van-icon-ascending:before{content:"\F00B"}.van-icon-audio:before{content:"\F00C"}.van-icon-award-o:before{content:"\F00D"}.van-icon-award:before{content:"\F00E"}.van-icon-back-top:before{content:"\F0E6"}.van-icon-bag-o:before{content:"\F00F"}.van-icon-bag:before{content:"\F010"}.van-icon-balance-list-o:before{content:"\F011"}.van-icon-balance-list:before{content:"\F012"}.van-icon-balance-o:before{content:"\F013"}.van-icon-balance-pay:before{content:"\F014"}.van-icon-bar-chart-o:before{content:"\F015"}.van-icon-bars:before{content:"\F016"}.van-icon-bell:before{content:"\F017"}.van-icon-bill-o:before{content:"\F018"}.van-icon-bill:before{content:"\F019"}.van-icon-birthday-cake-o:before{content:"\F01A"}.van-icon-bookmark-o:before{content:"\F01B"}.van-icon-bookmark:before{content:"\F01C"}.van-icon-browsing-history-o:before{content:"\F01D"}.van-icon-browsing-history:before{content:"\F01E"}.van-icon-brush-o:before{content:"\F01F"}.van-icon-bulb-o:before{content:"\F020"}.van-icon-bullhorn-o:before{content:"\F021"}.van-icon-calendar-o:before{content:"\F022"}.van-icon-card:before{content:"\F023"}.van-icon-cart-circle-o:before{content:"\F024"}.van-icon-cart-circle:before{content:"\F025"}.van-icon-cart-o:before{content:"\F026"}.van-icon-cart:before{content:"\F027"}.van-icon-cash-back-record:before{content:"\F028"}.van-icon-cash-on-deliver:before{content:"\F029"}.van-icon-cashier-o:before{content:"\F02A"}.van-icon-certificate:before{content:"\F02B"}.van-icon-chart-trending-o:before{content:"\F02C"}.van-icon-chat-o:before{content:"\F02D"}.van-icon-chat:before{content:"\F02E"}.van-icon-checked:before{content:"\F02F"}.van-icon-circle:before{content:"\F030"}.van-icon-clear:before{content:"\F031"}.van-icon-clock-o:before{content:"\F032"}.van-icon-clock:before{content:"\F033"}.van-icon-close:before{content:"\F034"}.van-icon-closed-eye:before{content:"\F035"}.van-icon-cluster-o:before{content:"\F036"}.van-icon-cluster:before{content:"\F037"}.van-icon-column:before{content:"\F038"}.van-icon-comment-circle-o:before{content:"\F039"}.van-icon-comment-circle:before{content:"\F03A"}.van-icon-comment-o:before{content:"\F03B"}.van-icon-comment:before{content:"\F03C"}.van-icon-completed:before{content:"\F03D"}.van-icon-contact:before{content:"\F03E"}.van-icon-coupon-o:before{content:"\F03F"}.van-icon-coupon:before{content:"\F040"}.van-icon-credit-pay:before{content:"\F041"}.van-icon-cross:before{content:"\F042"}.van-icon-debit-pay:before{content:"\F043"}.van-icon-delete-o:before{content:"\F0E9"}.van-icon-delete:before{content:"\F044"}.van-icon-descending:before{content:"\F045"}.van-icon-description:before{content:"\F046"}.van-icon-desktop-o:before{content:"\F047"}.van-icon-diamond-o:before{content:"\F048"}.van-icon-diamond:before{content:"\F049"}.van-icon-discount:before{content:"\F04A"}.van-icon-down:before{content:"\F04B"}.van-icon-ecard-pay:before{content:"\F04C"}.van-icon-edit:before{content:"\F04D"}.van-icon-ellipsis:before{content:"\F04E"}.van-icon-empty:before{content:"\F04F"}.van-icon-enlarge:before{content:"\F0E4"}.van-icon-envelop-o:before{content:"\F050"}.van-icon-exchange:before{content:"\F051"}.van-icon-expand-o:before{content:"\F052"}.van-icon-expand:before{content:"\F053"}.van-icon-eye-o:before{content:"\F054"}.van-icon-eye:before{content:"\F055"}.van-icon-fail:before{content:"\F056"}.van-icon-failure:before{content:"\F057"}.van-icon-filter-o:before{content:"\F058"}.van-icon-fire-o:before{content:"\F059"}.van-icon-fire:before{content:"\F05A"}.van-icon-flag-o:before{content:"\F05B"}.van-icon-flower-o:before{content:"\F05C"}.van-icon-font-o:before{content:"\F0EC"}.van-icon-font:before{content:"\F0EB"}.van-icon-free-postage:before{content:"\F05D"}.van-icon-friends-o:before{content:"\F05E"}.van-icon-friends:before{content:"\F05F"}.van-icon-gem-o:before{content:"\F060"}.van-icon-gem:before{content:"\F061"}.van-icon-gift-card-o:before{content:"\F062"}.van-icon-gift-card:before{content:"\F063"}.van-icon-gift-o:before{content:"\F064"}.van-icon-gift:before{content:"\F065"}.van-icon-gold-coin-o:before{content:"\F066"}.van-icon-gold-coin:before{content:"\F067"}.van-icon-good-job-o:before{content:"\F068"}.van-icon-good-job:before{content:"\F069"}.van-icon-goods-collect-o:before{content:"\F06A"}.van-icon-goods-collect:before{content:"\F06B"}.van-icon-graphic:before{content:"\F06C"}.van-icon-home-o:before{content:"\F06D"}.van-icon-hot-o:before{content:"\F06E"}.van-icon-hot-sale-o:before{content:"\F06F"}.van-icon-hot-sale:before{content:"\F070"}.van-icon-hot:before{content:"\F071"}.van-icon-hotel-o:before{content:"\F072"}.van-icon-idcard:before{content:"\F073"}.van-icon-info-o:before{content:"\F074"}.van-icon-info:before{content:"\F075"}.van-icon-invition:before{content:"\F076"}.van-icon-label-o:before{content:"\F077"}.van-icon-label:before{content:"\F078"}.van-icon-like-o:before{content:"\F079"}.van-icon-like:before{content:"\F07A"}.van-icon-live:before{content:"\F07B"}.van-icon-location-o:before{content:"\F07C"}.van-icon-location:before{content:"\F07D"}.van-icon-lock:before{content:"\F07E"}.van-icon-logistics:before{content:"\F07F"}.van-icon-manager-o:before{content:"\F080"}.van-icon-manager:before{content:"\F081"}.van-icon-map-marked:before{content:"\F082"}.van-icon-medal-o:before{content:"\F083"}.van-icon-medal:before{content:"\F084"}.van-icon-minus:before{content:"\F0E8"}.van-icon-more-o:before{content:"\F085"}.van-icon-more:before{content:"\F086"}.van-icon-music-o:before{content:"\F087"}.van-icon-music:before{content:"\F088"}.van-icon-new-arrival-o:before{content:"\F089"}.van-icon-new-arrival:before{content:"\F08A"}.van-icon-new-o:before{content:"\F08B"}.van-icon-new:before{content:"\F08C"}.van-icon-newspaper-o:before{content:"\F08D"}.van-icon-notes-o:before{content:"\F08E"}.van-icon-orders-o:before{content:"\F08F"}.van-icon-other-pay:before{content:"\F090"}.van-icon-paid:before{content:"\F091"}.van-icon-passed:before{content:"\F092"}.van-icon-pause-circle-o:before{content:"\F093"}.van-icon-pause-circle:before{content:"\F094"}.van-icon-pause:before{content:"\F095"}.van-icon-peer-pay:before{content:"\F096"}.van-icon-pending-payment:before{content:"\F097"}.van-icon-phone-circle-o:before{content:"\F098"}.van-icon-phone-circle:before{content:"\F099"}.van-icon-phone-o:before{content:"\F09A"}.van-icon-phone:before{content:"\F09B"}.van-icon-photo-fail:before{content:"\F0E5"}.van-icon-photo-o:before{content:"\F09C"}.van-icon-photo:before{content:"\F09D"}.van-icon-photograph:before{content:"\F09E"}.van-icon-play-circle-o:before{content:"\F09F"}.van-icon-play-circle:before{content:"\F0A0"}.van-icon-play:before{content:"\F0A1"}.van-icon-plus:before{content:"\F0A2"}.van-icon-point-gift-o:before{content:"\F0A3"}.van-icon-point-gift:before{content:"\F0A4"}.van-icon-points:before{content:"\F0A5"}.van-icon-printer:before{content:"\F0A6"}.van-icon-qr-invalid:before{content:"\F0A7"}.van-icon-qr:before{content:"\F0A8"}.van-icon-question-o:before{content:"\F0A9"}.van-icon-question:before{content:"\F0AA"}.van-icon-records:before{content:"\F0AB"}.van-icon-refund-o:before{content:"\F0AC"}.van-icon-replay:before{content:"\F0AD"}.van-icon-revoke:before{content:"\F0ED"}.van-icon-scan:before{content:"\F0AE"}.van-icon-search:before{content:"\F0AF"}.van-icon-send-gift-o:before{content:"\F0B0"}.van-icon-send-gift:before{content:"\F0B1"}.van-icon-service-o:before{content:"\F0B2"}.van-icon-service:before{content:"\F0B3"}.van-icon-setting-o:before{content:"\F0B4"}.van-icon-setting:before{content:"\F0B5"}.van-icon-share-o:before{content:"\F0E7"}.van-icon-share:before{content:"\F0B6"}.van-icon-shop-collect-o:before{content:"\F0B7"}.van-icon-shop-collect:before{content:"\F0B8"}.van-icon-shop-o:before{content:"\F0B9"}.van-icon-shop:before{content:"\F0BA"}.van-icon-shopping-cart-o:before{content:"\F0BB"}.van-icon-shopping-cart:before{content:"\F0BC"}.van-icon-shrink:before{content:"\F0BD"}.van-icon-sign:before{content:"\F0BE"}.van-icon-smile-comment-o:before{content:"\F0BF"}.van-icon-smile-comment:before{content:"\F0C0"}.van-icon-smile-o:before{content:"\F0C1"}.van-icon-smile:before{content:"\F0C2"}.van-icon-sort:before{content:"\F0EA"}.van-icon-star-o:before{content:"\F0C3"}.van-icon-star:before{content:"\F0C4"}.van-icon-stop-circle-o:before{content:"\F0C5"}.van-icon-stop-circle:before{content:"\F0C6"}.van-icon-stop:before{content:"\F0C7"}.van-icon-success:before{content:"\F0C8"}.van-icon-thumb-circle-o:before{content:"\F0C9"}.van-icon-thumb-circle:before{content:"\F0CA"}.van-icon-todo-list-o:before{content:"\F0CB"}.van-icon-todo-list:before{content:"\F0CC"}.van-icon-tosend:before{content:"\F0CD"}.van-icon-tv-o:before{content:"\F0CE"}.van-icon-umbrella-circle:before{content:"\F0CF"}.van-icon-underway-o:before{content:"\F0D0"}.van-icon-underway:before{content:"\F0D1"}.van-icon-upgrade:before{content:"\F0D2"}.van-icon-user-circle-o:before{content:"\F0D3"}.van-icon-user-o:before{content:"\F0D4"}.van-icon-video-o:before{content:"\F0D5"}.van-icon-video:before{content:"\F0D6"}.van-icon-vip-card-o:before{content:"\F0D7"}.van-icon-vip-card:before{content:"\F0D8"}.van-icon-volume-o:before{content:"\F0D9"}.van-icon-volume:before{content:"\F0DA"}.van-icon-wap-home-o:before{content:"\F0DB"}.van-icon-wap-home:before{content:"\F0DC"}.van-icon-wap-nav:before{content:"\F0DD"}.van-icon-warn-o:before{content:"\F0DE"}.van-icon-warning-o:before{content:"\F0DF"}.van-icon-warning:before{content:"\F0E0"}.van-icon-weapp-nav:before{content:"\F0E1"}.van-icon-wechat-pay:before{content:"\F0E2"}.van-icon-wechat:before{content:"\F0EE"}.van-icon-youzan-shield:before{content:"\F0E3"}:host{display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-icon--image{width:1em;height:1em}.van-icon__image{width:100%;height:100%}.van-icon__info{z-index:1} \ No newline at end of file +@import '../common/index.wxss'; + +@font-face { + font-weight: 400; + font-family: vant-icon; + font-style: normal; + font-display: auto; + src: url(https://img01.yzcdn.cn/vant/vant-icon-f463a9.woff2) format("woff2"), url(https://img01.yzcdn.cn/vant/vant-icon-f463a9.woff) format("woff"), url(https://img01.yzcdn.cn/vant/vant-icon-f463a9.ttf) format("truetype") +} + +.van-icon { + position: relative; + font: normal normal normal 14px/1 vant-icon; + font-size: inherit; + text-rendering: auto; + -webkit-font-smoothing: antialiased +} + +.van-icon, +.van-icon:before { + display: inline-block +} + +.van-icon-add-o:before { + content: "\F000" +} + +.van-icon-add-square:before { + content: "\F001" +} + +.van-icon-add:before { + content: "\F002" +} + +.van-icon-after-sale:before { + content: "\F003" +} + +.van-icon-aim:before { + content: "\F004" +} + +.van-icon-alipay:before { + content: "\F005" +} + +.van-icon-apps-o:before { + content: "\F006" +} + +.van-icon-arrow-down:before { + content: "\F007" +} + +.van-icon-arrow-left:before { + content: "\F008" +} + +.van-icon-arrow-up:before { + content: "\F009" +} + +.van-icon-arrow:before { + content: "\F00A" +} + +.van-icon-ascending:before { + content: "\F00B" +} + +.van-icon-audio:before { + content: "\F00C" +} + +.van-icon-award-o:before { + content: "\F00D" +} + +.van-icon-award:before { + content: "\F00E" +} + +.van-icon-back-top:before { + content: "\F0E6" +} + +.van-icon-bag-o:before { + content: "\F00F" +} + +.van-icon-bag:before { + content: "\F010" +} + +.van-icon-balance-list-o:before { + content: "\F011" +} + +.van-icon-balance-list:before { + content: "\F012" +} + +.van-icon-balance-o:before { + content: "\F013" +} + +.van-icon-balance-pay:before { + content: "\F014" +} + +.van-icon-bar-chart-o:before { + content: "\F015" +} + +.van-icon-bars:before { + content: "\F016" +} + +.van-icon-bell:before { + content: "\F017" +} + +.van-icon-bill-o:before { + content: "\F018" +} + +.van-icon-bill:before { + content: "\F019" +} + +.van-icon-birthday-cake-o:before { + content: "\F01A" +} + +.van-icon-bookmark-o:before { + content: "\F01B" +} + +.van-icon-bookmark:before { + content: "\F01C" +} + +.van-icon-browsing-history-o:before { + content: "\F01D" +} + +.van-icon-browsing-history:before { + content: "\F01E" +} + +.van-icon-brush-o:before { + content: "\F01F" +} + +.van-icon-bulb-o:before { + content: "\F020" +} + +.van-icon-bullhorn-o:before { + content: "\F021" +} + +.van-icon-calendar-o:before { + content: "\F022" +} + +.van-icon-card:before { + content: "\F023" +} + +.van-icon-cart-circle-o:before { + content: "\F024" +} + +.van-icon-cart-circle:before { + content: "\F025" +} + +.van-icon-cart-o:before { + content: "\F026" +} + +.van-icon-cart:before { + content: "\F027" +} + +.van-icon-cash-back-record:before { + content: "\F028" +} + +.van-icon-cash-on-deliver:before { + content: "\F029" +} + +.van-icon-cashier-o:before { + content: "\F02A" +} + +.van-icon-certificate:before { + content: "\F02B" +} + +.van-icon-chart-trending-o:before { + content: "\F02C" +} + +.van-icon-chat-o:before { + content: "\F02D" +} + +.van-icon-chat:before { + content: "\F02E" +} + +.van-icon-checked:before { + content: "\F02F" +} + +.van-icon-circle:before { + content: "\F030" +} + +.van-icon-clear:before { + content: "\F031" +} + +.van-icon-clock-o:before { + content: "\F032" +} + +.van-icon-clock:before { + content: "\F033" +} + +.van-icon-close:before { + content: "\F034" +} + +.van-icon-closed-eye:before { + content: "\F035" +} + +.van-icon-cluster-o:before { + content: "\F036" +} + +.van-icon-cluster:before { + content: "\F037" +} + +.van-icon-column:before { + content: "\F038" +} + +.van-icon-comment-circle-o:before { + content: "\F039" +} + +.van-icon-comment-circle:before { + content: "\F03A" +} + +.van-icon-comment-o:before { + content: "\F03B" +} + +.van-icon-comment:before { + content: "\F03C" +} + +.van-icon-completed:before { + content: "\F03D" +} + +.van-icon-contact:before { + content: "\F03E" +} + +.van-icon-coupon-o:before { + content: "\F03F" +} + +.van-icon-coupon:before { + content: "\F040" +} + +.van-icon-credit-pay:before { + content: "\F041" +} + +.van-icon-cross:before { + content: "\F042" +} + +.van-icon-debit-pay:before { + content: "\F043" +} + +.van-icon-delete-o:before { + content: "\F0E9" +} + +.van-icon-delete:before { + content: "\F044" +} + +.van-icon-descending:before { + content: "\F045" +} + +.van-icon-description:before { + content: "\F046" +} + +.van-icon-desktop-o:before { + content: "\F047" +} + +.van-icon-diamond-o:before { + content: "\F048" +} + +.van-icon-diamond:before { + content: "\F049" +} + +.van-icon-discount:before { + content: "\F04A" +} + +.van-icon-down:before { + content: "\F04B" +} + +.van-icon-ecard-pay:before { + content: "\F04C" +} + +.van-icon-edit:before { + content: "\F04D" +} + +.van-icon-ellipsis:before { + content: "\F04E" +} + +.van-icon-empty:before { + content: "\F04F" +} + +.van-icon-enlarge:before { + content: "\F0E4" +} + +.van-icon-envelop-o:before { + content: "\F050" +} + +.van-icon-exchange:before { + content: "\F051" +} + +.van-icon-expand-o:before { + content: "\F052" +} + +.van-icon-expand:before { + content: "\F053" +} + +.van-icon-eye-o:before { + content: "\F054" +} + +.van-icon-eye:before { + content: "\F055" +} + +.van-icon-fail:before { + content: "\F056" +} + +.van-icon-failure:before { + content: "\F057" +} + +.van-icon-filter-o:before { + content: "\F058" +} + +.van-icon-fire-o:before { + content: "\F059" +} + +.van-icon-fire:before { + content: "\F05A" +} + +.van-icon-flag-o:before { + content: "\F05B" +} + +.van-icon-flower-o:before { + content: "\F05C" +} + +.van-icon-font-o:before { + content: "\F0EC" +} + +.van-icon-font:before { + content: "\F0EB" +} + +.van-icon-free-postage:before { + content: "\F05D" +} + +.van-icon-friends-o:before { + content: "\F05E" +} + +.van-icon-friends:before { + content: "\F05F" +} + +.van-icon-gem-o:before { + content: "\F060" +} + +.van-icon-gem:before { + content: "\F061" +} + +.van-icon-gift-card-o:before { + content: "\F062" +} + +.van-icon-gift-card:before { + content: "\F063" +} + +.van-icon-gift-o:before { + content: "\F064" +} + +.van-icon-gift:before { + content: "\F065" +} + +.van-icon-gold-coin-o:before { + content: "\F066" +} + +.van-icon-gold-coin:before { + content: "\F067" +} + +.van-icon-good-job-o:before { + content: "\F068" +} + +.van-icon-good-job:before { + content: "\F069" +} + +.van-icon-goods-collect-o:before { + content: "\F06A" +} + +.van-icon-goods-collect:before { + content: "\F06B" +} + +.van-icon-graphic:before { + content: "\F06C" +} + +.van-icon-home-o:before { + content: "\F06D" +} + +.van-icon-hot-o:before { + content: "\F06E" +} + +.van-icon-hot-sale-o:before { + content: "\F06F" +} + +.van-icon-hot-sale:before { + content: "\F070" +} + +.van-icon-hot:before { + content: "\F071" +} + +.van-icon-hotel-o:before { + content: "\F072" +} + +.van-icon-idcard:before { + content: "\F073" +} + +.van-icon-info-o:before { + content: "\F074" +} + +.van-icon-info:before { + content: "\F075" +} + +.van-icon-invition:before { + content: "\F076" +} + +.van-icon-label-o:before { + content: "\F077" +} + +.van-icon-label:before { + content: "\F078" +} + +.van-icon-like-o:before { + content: "\F079" +} + +.van-icon-like:before { + content: "\F07A" +} + +.van-icon-live:before { + content: "\F07B" +} + +.van-icon-location-o:before { + content: "\F07C" +} + +.van-icon-location:before { + content: "\F07D" +} + +.van-icon-lock:before { + content: "\F07E" +} + +.van-icon-logistics:before { + content: "\F07F" +} + +.van-icon-manager-o:before { + content: "\F080" +} + +.van-icon-manager:before { + content: "\F081" +} + +.van-icon-map-marked:before { + content: "\F082" +} + +.van-icon-medal-o:before { + content: "\F083" +} + +.van-icon-medal:before { + content: "\F084" +} + +.van-icon-minus:before { + content: "\F0E8" +} + +.van-icon-more-o:before { + content: "\F085" +} + +.van-icon-more:before { + content: "\F086" +} + +.van-icon-music-o:before { + content: "\F087" +} + +.van-icon-music:before { + content: "\F088" +} + +.van-icon-new-arrival-o:before { + content: "\F089" +} + +.van-icon-new-arrival:before { + content: "\F08A" +} + +.van-icon-new-o:before { + content: "\F08B" +} + +.van-icon-new:before { + content: "\F08C" +} + +.van-icon-newspaper-o:before { + content: "\F08D" +} + +.van-icon-notes-o:before { + content: "\F08E" +} + +.van-icon-orders-o:before { + content: "\F08F" +} + +.van-icon-other-pay:before { + content: "\F090" +} + +.van-icon-paid:before { + content: "\F091" +} + +.van-icon-passed:before { + content: "\F092" +} + +.van-icon-pause-circle-o:before { + content: "\F093" +} + +.van-icon-pause-circle:before { + content: "\F094" +} + +.van-icon-pause:before { + content: "\F095" +} + +.van-icon-peer-pay:before { + content: "\F096" +} + +.van-icon-pending-payment:before { + content: "\F097" +} + +.van-icon-phone-circle-o:before { + content: "\F098" +} + +.van-icon-phone-circle:before { + content: "\F099" +} + +.van-icon-phone-o:before { + content: "\F09A" +} + +.van-icon-phone:before { + content: "\F09B" +} + +.van-icon-photo-fail:before { + content: "\F0E5" +} + +.van-icon-photo-o:before { + content: "\F09C" +} + +.van-icon-photo:before { + content: "\F09D" +} + +.van-icon-photograph:before { + content: "\F09E" +} + +.van-icon-play-circle-o:before { + content: "\F09F" +} + +.van-icon-play-circle:before { + content: "\F0A0" +} + +.van-icon-play:before { + content: "\F0A1" +} + +.van-icon-plus:before { + content: "\F0A2" +} + +.van-icon-point-gift-o:before { + content: "\F0A3" +} + +.van-icon-point-gift:before { + content: "\F0A4" +} + +.van-icon-points:before { + content: "\F0A5" +} + +.van-icon-printer:before { + content: "\F0A6" +} + +.van-icon-qr-invalid:before { + content: "\F0A7" +} + +.van-icon-qr:before { + content: "\F0A8" +} + +.van-icon-question-o:before { + content: "\F0A9" +} + +.van-icon-question:before { + content: "\F0AA" +} + +.van-icon-records:before { + content: "\F0AB" +} + +.van-icon-refund-o:before { + content: "\F0AC" +} + +.van-icon-replay:before { + content: "\F0AD" +} + +.van-icon-revoke:before { + content: "\F0ED" +} + +.van-icon-scan:before { + content: "\F0AE" +} + +.van-icon-search:before { + content: "\F0AF" +} + +.van-icon-send-gift-o:before { + content: "\F0B0" +} + +.van-icon-send-gift:before { + content: "\F0B1" +} + +.van-icon-service-o:before { + content: "\F0B2" +} + +.van-icon-service:before { + content: "\F0B3" +} + +.van-icon-setting-o:before { + content: "\F0B4" +} + +.van-icon-setting:before { + content: "\F0B5" +} + +.van-icon-share-o:before { + content: "\F0E7" +} + +.van-icon-share:before { + content: "\F0B6" +} + +.van-icon-shop-collect-o:before { + content: "\F0B7" +} + +.van-icon-shop-collect:before { + content: "\F0B8" +} + +.van-icon-shop-o:before { + content: "\F0B9" +} + +.van-icon-shop:before { + content: "\F0BA" +} + +.van-icon-shopping-cart-o:before { + content: "\F0BB" +} + +.van-icon-shopping-cart:before { + content: "\F0BC" +} + +.van-icon-shrink:before { + content: "\F0BD" +} + +.van-icon-sign:before { + content: "\F0BE" +} + +.van-icon-smile-comment-o:before { + content: "\F0BF" +} + +.van-icon-smile-comment:before { + content: "\F0C0" +} + +.van-icon-smile-o:before { + content: "\F0C1" +} + +.van-icon-smile:before { + content: "\F0C2" +} + +.van-icon-sort:before { + content: "\F0EA" +} + +.van-icon-star-o:before { + content: "\F0C3" +} + +.van-icon-star:before { + content: "\F0C4" +} + +.van-icon-stop-circle-o:before { + content: "\F0C5" +} + +.van-icon-stop-circle:before { + content: "\F0C6" +} + +.van-icon-stop:before { + content: "\F0C7" +} + +.van-icon-success:before { + content: "\F0C8" +} + +.van-icon-thumb-circle-o:before { + content: "\F0C9" +} + +.van-icon-thumb-circle:before { + content: "\F0CA" +} + +.van-icon-todo-list-o:before { + content: "\F0CB" +} + +.van-icon-todo-list:before { + content: "\F0CC" +} + +.van-icon-tosend:before { + content: "\F0CD" +} + +.van-icon-tv-o:before { + content: "\F0CE" +} + +.van-icon-umbrella-circle:before { + content: "\F0CF" +} + +.van-icon-underway-o:before { + content: "\F0D0" +} + +.van-icon-underway:before { + content: "\F0D1" +} + +.van-icon-upgrade:before { + content: "\F0D2" +} + +.van-icon-user-circle-o:before { + content: "\F0D3" +} + +.van-icon-user-o:before { + content: "\F0D4" +} + +.van-icon-video-o:before { + content: "\F0D5" +} + +.van-icon-video:before { + content: "\F0D6" +} + +.van-icon-vip-card-o:before { + content: "\F0D7" +} + +.van-icon-vip-card:before { + content: "\F0D8" +} + +.van-icon-volume-o:before { + content: "\F0D9" +} + +.van-icon-volume:before { + content: "\F0DA" +} + +.van-icon-wap-home-o:before { + content: "\F0DB" +} + +.van-icon-wap-home:before { + content: "\F0DC" +} + +.van-icon-wap-nav:before { + content: "\F0DD" +} + +.van-icon-warn-o:before { + content: "\F0DE" +} + +.van-icon-warning-o:before { + content: "\F0DF" +} + +.van-icon-warning:before { + content: "\F0E0" +} + +.van-icon-weapp-nav:before { + content: "\F0E1" +} + +.van-icon-wechat-pay:before { + content: "\F0E2" +} + +.van-icon-wechat:before { + content: "\F0EE" +} + +.van-icon-youzan-shield:before { + content: "\F0E3" +} + +:host { + display: -webkit-inline-flex; + display: inline-flex; + -webkit-align-items: center; + align-items: center; + -webkit-justify-content: center; + justify-content: center +} + +.van-icon--image { + width: 1em; + height: 1em +} + +.van-icon__image { + width: 100%; + height: 100% +} + +.van-icon__info { + z-index: 1 +} \ No newline at end of file