diff --git a/pages/index/index.js b/pages/index/index.js
index 0822603..49c0b61 100644
--- a/pages/index/index.js
+++ b/pages/index/index.js
@@ -81,6 +81,7 @@ Page({
}
})
},
+ //保存用户头像及微信昵称
doSaveUserInfo() {
try {
console.log('保存')
@@ -328,12 +329,16 @@ Page({
}
},
onPullDownRefresh() {
- this.setData({
- dataList: [],
- cardInfo: null,
- areaList: null
- })
- this.getCard()
+ if (app.globalData.token != '') {
+ this.setData({
+ dataList: [],
+ cardInfo: null,
+ areaList: null
+ })
+ this.getCard()
+ } else {
+ this.doLogin()
+ }
},
//预览图片
viewImg(e) {
@@ -500,33 +505,13 @@ Page({
data: {}
}).then(res => {
var area = res.data.areaList
- for (let i = 0; i < area.length; i++) {
- if (area[i].templateAreaServerLink == '1') {
- if (area[i].templateAreaFontValue.length > area[i].templateAreaFontLength) {
- area[i].templateAreaFontValue = area[i].templateAreaFontValue.substring(area[i].templateAreaFontLength, -1)
- }
- }
- area[i].templateAreaFontSize = Math.floor(area[i].templateAreaFontSize * 750 / wx.getSystemInfoSync().windowWidth) + 'rpx'
- if (area[i].templateAreaFontCenter == '1') {
- area[i].templateAreaFontCenter = 'left'
- } else if (area[i].templateAreaFontCenter == '2') {
- area[i].templateAreaFontCenter = 'center'
- } else {
- area[i].templateAreaFontCenter = 'right'
- }
- if (area[i].templateAreaFontBold == '0') {
- area[i].templateAreaFontBold = 'normal'
- } else if (area[i].templateAreaFontBold == '1') {
- area[i].templateAreaFontBold = 'bold'
- } else {
- area[i]['templateAreaFontStyle'] = 'italic'
- }
- if (area[i].templateAreaSource == 'name') {
+ area.forEach(it => {
+ if (it.templateAreaSource == 'name') {
self.setData({
- nameTxt: area[i].templateAreaFontValue
+ nameTxt: it.templateAreaFontValue
})
}
- }
+ })
self.setData({
cardInfo: res.data,
areaList: area,
@@ -534,7 +519,7 @@ Page({
})
if (res.data) {
- self.toSaveLocalImg(res.data.cardTemplateUseDispatchPhoto)
+ self.toSaveLocalImg(res.data.cardTemplateUsePhotoUrl)
self.getBrowCardUserList(res.data.cardTemplateUseId)
self.setData({
tempUserId: res.data.creator,
@@ -821,14 +806,27 @@ Page({
},
//将分享的Base64图片保存至本地
toSaveLocalImg(data) {
- var base64 = data
+ var _self = this
+ var base64 = _self.data.cardUrl + data
var imgPath = wx.env.USER_DATA_PATH + '/index' + 'share.png'
- var imageData = base64.replace(/^data:image\/\w+;base64,/, "");
- var fs = wx.getFileSystemManager();
- fs.writeFileSync(imgPath, imageData, "base64");
- this.setData({
- shareImgUrl: imgPath
+ wx.downloadFile({
+ url: base64,
+ header: {
+ token: app.globalData.token
+ },
+ filePath: imgPath,
+ success(res) {
+ if (res.statusCode == 200) {
+ _self.setData({
+ shareImgUrl: imgPath
+ })
+ }
+ },
+ fail(err) {
+ console.log(err)
+ }
})
+
},
//显示详情
showDetail(e) {
@@ -866,57 +864,41 @@ Page({
getCard() {
var self = this
app.http.get(app.urls.shareCard.format({
- cardTemplateUseId: self.data.cardTemplateUseId
- }), {
- header: {
- token: app.globalData.token
- }
- }).then(res => {
- var area = res.data.areaList
- for (let i = 0; i < area.length; i++) {
- if (area[i].templateAreaServerLink == '1') {
- if (area[i].templateAreaFontValue.length > area[i].templateAreaFontLength) {
- area[i].templateAreaFontValue = area[i].templateAreaFontValue.substring(area[i].templateAreaFontLength, -1)
+ cardTemplateUseId: self.data.cardTemplateUseId
+ }), {
+ header: {
+ token: app.globalData.token
+ }
+ }).then(res => {
+ wx.stopPullDownRefresh({})
+ var area = res.data.areaList
+ area.forEach(it => {
+ if (it.templateAreaSource == 'name') {
+ self.setData({
+ nameTxt: it.templateAreaFontValue
+ })
}
- }
- area[i].templateAreaFontSize = Math.floor(area[i].templateAreaFontSize * 750 / wx.getSystemInfoSync().windowWidth) + 'rpx'
- if (area[i].templateAreaFontCenter == '1') {
- area[i].templateAreaFontCenter = 'left'
- } else if (area[i].templateAreaFontCenter == '2') {
- area[i].templateAreaFontCenter = 'center'
- } else {
- area[i].templateAreaFontCenter = 'right'
- }
- if (area[i].templateAreaFontBold == '0') {
- area[i].templateAreaFontBold = 'normal'
- } else if (area[i].templateAreaFontBold == '1') {
- area[i].templateAreaFontBold = 'bold'
- } else {
- area[i]['templateAreaFontStyle'] = 'italic'
- }
- if (area[i].templateAreaSource == 'name') {
- self.setData({
- nameTxt: area[i].templateAreaFontValue
- })
- }
- }
- self.setData({
- cardInfo: res.data,
- areaList: area,
- dataList: []
- })
-
- if (res.data) {
- self.toSaveLocalImg(res.data.cardTemplateUseDispatchPhoto) //保存分享的图片
- self.getBrowCardUserList(res.data.cardTemplateUseId) //获取浏览数量
- app.globalData.userId = res.data.creator //保存当前名片的用户ID
- self.setData({
- tempUserId: res.data.creator
})
- self.getMainColumn(res.data.creator) //获取当前用户的栏目
- self.getMainBaseUserInfo(res.data.creator)
- }
- })
+ self.setData({
+ cardInfo: res.data,
+ areaList: area,
+ dataList: []
+ })
+
+ if (res.data) {
+ self.toSaveLocalImg(res.data.cardTemplateUsePhotoUrl) //保存分享的图片
+ self.getBrowCardUserList(res.data.cardTemplateUseId) //获取浏览数量
+ app.globalData.userId = res.data.creator //保存当前名片的用户ID
+ self.setData({
+ tempUserId: res.data.creator
+ })
+ self.getMainColumn(res.data.creator) //获取当前用户的栏目
+ self.getMainBaseUserInfo(res.data.creator)
+ }
+ })
+ .catch(err => {
+ wx.stopPullDownRefresh({})
+ })
},
// 保存查看记录
@@ -1021,50 +1003,4 @@ Page({
otherCardList: _self.data.otherCardList
})
},
- //构建名片数据
- buildCardData(res) {
- var area = res.data.areaList
- for (let i = 0; i < area.length; i++) {
- if (area[i].templateAreaServerLink == '1') {
- if (area[i].templateAreaFontValue.length > area[i].templateAreaFontLength) {
- area[i].templateAreaFontValue = area[i].templateAreaFontValue.substring(area[i].templateAreaFontLength, -1)
- }
- }
- area[i].templateAreaFontSize = Math.floor(area[i].templateAreaFontSize * 750 / wx.getSystemInfoSync().windowWidth) + 'rpx'
- if (area[i].templateAreaFontCenter == '1') {
- area[i].templateAreaFontCenter = 'left'
- } else if (area[i].templateAreaFontCenter == '2') {
- area[i].templateAreaFontCenter = 'center'
- } else {
- area[i].templateAreaFontCenter = 'right'
- }
- if (area[i].templateAreaFontBold == '0') {
- area[i].templateAreaFontBold = 'normal'
- } else if (area[i].templateAreaFontBold == '1') {
- area[i].templateAreaFontBold = 'bold'
- } else {
- area[i]['templateAreaFontStyle'] = 'italic'
- }
- if (area[i].templateAreaSource == 'name') {
- self.setData({
- nameTxt: area[i].templateAreaFontValue
- })
- }
- }
- self.setData({
- cardInfo: res.data,
- areaList: area,
- dataList: []
- })
-
- if (res.data) {
- self.toSaveLocalImg(res.data.cardTemplateUseDispatchPhoto) //保存分享的图片
- self.getBrowCardUserList(res.data.cardTemplateUseId) //获取浏览数量
- app.globalData.userId = res.data.creator //保存当前名片的用户ID
- self.setData({
- tempUserId: res.data.creator
- })
- self.getMainColumn(res.data.creator) //获取当前用户的栏目
- }
- }
})
\ No newline at end of file
diff --git a/pages/index/index.wxml b/pages/index/index.wxml
index 1f4d8b9..5272d65 100644
--- a/pages/index/index.wxml
+++ b/pages/index/index.wxml
@@ -14,19 +14,8 @@
-
-
- {{item.templateAreaFontValue}}
-
-
-
-
-
+
+
diff --git a/pages/index/index.wxss b/pages/index/index.wxss
index 32f3cdb..d14f22f 100644
--- a/pages/index/index.wxss
+++ b/pages/index/index.wxss
@@ -33,6 +33,7 @@ page {
left: 0;
width: 100%;
height: 100%;
+ padding: 10rpx;
}
.person {
@@ -413,9 +414,8 @@ page {
justify-content: space-between;
padding-left: 40rpx;
width: 100%;
- margin-top: 40rpx;
padding-top: 40rpx;
- padding-bottom: 30rpx;
+ padding-bottom: 20rpx;
background-color: #fff;
}
@@ -452,6 +452,7 @@ page {
.good-avatar image {
width: 100%;
height: 100%;
+ border-radius: 50%;
}
.good-click image {
diff --git a/pages/mine/index/index.wxml b/pages/mine/index/index.wxml
index b4f3aa5..96a1eb2 100644
--- a/pages/mine/index/index.wxml
+++ b/pages/mine/index/index.wxml
@@ -61,7 +61,7 @@
{{group.configColumnGroupName}}
+ class="flex align-center justify-center" style="width:100%;" bindtap="toFunction">
@@ -73,7 +73,7 @@
-
+
diff --git a/pages/mine/myCard/myCard.js b/pages/mine/myCard/myCard.js
index 661525a..2d78d5d 100644
--- a/pages/mine/myCard/myCard.js
+++ b/pages/mine/myCard/myCard.js
@@ -23,9 +23,8 @@ Page({
// 我的名片列表
getList: function () {
var self = this
- wx.showToast({
- title: '加载中',
- icon: 'loading'
+ wx.showLoading({
+ title: '加载中...',
})
wx.showNavigationBarLoading()
app.http.get(app.urls.getMyCard, {
@@ -34,13 +33,14 @@ Page({
},
data: {}
}).then(res => {
+ wx.hideLoading({})
self.setData({
cardList: res.data
})
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
- wx.hideToast()
}).catch(res => {
+ wx.hideLoading({})
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
})
@@ -54,6 +54,9 @@ Page({
},
// 获取他人名片列表
getOtherCard: function () {
+ wx.showLoading({
+ title: '加载中...',
+ })
var self = this
app.http.get(app.urls.otherCardList, {
header: {
@@ -61,6 +64,7 @@ Page({
},
data: {}
}).then(res => {
+ wx.hideLoading({})
wx.stopPullDownRefresh({})
var curArr
if (res.data.rows.length > 0) {
@@ -75,10 +79,14 @@ Page({
}
})
.catch(err => {
+ wx.hideLoading({})
wx.stopPullDownRefresh({})
})
},
getHistory() {
+ wx.showLoading({
+ title: '加载中...',
+ })
var _self = this
app.http.get(app.urls.getBrowseHistoryList, {
header: {
@@ -86,6 +94,7 @@ Page({
}
})
.then(res => {
+ wx.hideLoading({})
wx.stopPullDownRefresh({})
var curArr
if (res.data.rows.length > 0) {
@@ -100,6 +109,7 @@ Page({
}
})
.catch(err => {
+ wx.hideLoading({})
wx.stopPullDownRefresh({})
console.log(err)
})
diff --git a/pages/mine/myCard/myCard.wxml b/pages/mine/myCard/myCard.wxml
index e23a40b..f9ae95c 100644
--- a/pages/mine/myCard/myCard.wxml
+++ b/pages/mine/myCard/myCard.wxml
@@ -15,7 +15,7 @@
style="padding-bottom:{{(list.cardTemplateUseHeight / list.cardTemplateUseWidth) *100 +'%'}};">
主名片
-
+
{{list.cardTemplateUseTitle}}
@@ -35,7 +35,7 @@
style="padding-bottom:{{(list.cardTemplateUseDTO.cardTemplateUseHeight / list.cardTemplateUseDTO.cardTemplateUseWidth) *100 +'%'}};">
置顶
-
+
@@ -61,7 +61,7 @@
style="padding-bottom:{{(list.cardTemplateUseDTO.cardTemplateUseHeight / list.cardTemplateUseDTO.cardTemplateUseWidth) *100 +'%'}};">
置顶
-
+
diff --git a/pages/mine/otherCard/othercarddetail.js b/pages/mine/otherCard/othercarddetail.js
index 5c181bc..e648b34 100644
--- a/pages/mine/otherCard/othercarddetail.js
+++ b/pages/mine/otherCard/othercarddetail.js
@@ -43,29 +43,115 @@ Page({
self.buildId()
self.getCard()
},
+ // 获取名片
+ getCard() {
+ var self = this
+ app.http.get(app.urls.shareCard.format({
+ cardTemplateUseId: self.data.cardTemplateUseId
+ }), {
+ header: {
+ token: app.globalData.token
+ }
+ }).then(res => {
+ var area = res.data.areaList
+ area.forEach(it => {
+ if (it.templateAreaSource == 'name') {
+ self.setData({
+ nameTxt: it.templateAreaFontValue
+ })
+ }
+ })
+ self.setData({
+ cardInfo: res.data,
+ areaList: area,
+ dataList: []
+ })
+ if (res.data) {
+ self.toSaveLocalImg(res.data.cardTemplateUsePhotoUrl) //保存分享的图片
+ self.getBrowCardUserList(res.data.cardTemplateUseId) //获取浏览数量
+ self.setData({
+ tempUserId: res.data.creator
+ })
+ self.getMainColumn(res.data.creator) //获取当前用户的栏目
+ self.getMainBaseUserInfo(res.data.creator) //获取当前人员基础信息
+ }
+ })
+ },
+ //将分享的Base64图片保存至本地
+ toSaveLocalImg(data) {
+ var _self = this
+ var base64 = _self.data.cardUrl + data
+ var imgPath = wx.env.USER_DATA_PATH + '/index' + 'share.png'
+ wx.downloadFile({
+ url: base64,
+ header: {
+ token: app.globalData.token
+ },
+ filePath: imgPath,
+ success(res) {
+ if (res.statusCode == 200) {
+ _self.setData({
+ shareImgUrl: imgPath
+ })
+ }
+ },
+ fail(err) {
+ console.log(err)
+ }
+ })
+ },
+ //获取浏览当前名片的用户头像列表
+ getBrowCardUserList(id) {
+ var _self = this
+ app.http.get(app.urls.getCardBrowUserList, {
+ header: {
+ token: app.globalData.token
+ },
+ data: {
+ page: '1',
+ rows: '7',
+ cardTemplateUseId: id
+ }
+ })
+ .then(res => {
+ if (res.data) {
+ _self.setData({
+ browUserList: res.data.rows
+ })
+ }
+ })
+ .catch(err => {
+ console.log(err)
+ })
+ },
//获取首页展示的栏目
getMainColumn(id) {
+ console.log(id)
var _self = this
+ _self.setData({
+ dataList: []
+ })
app.http.get(app.urls.getMainColumn, {
header: {
token: app.globalData.token
},
data: {
- cardTemplateUseId: id
+ creator: id
}
})
.then(res => {
wx.showLoading({
title: '加载中...',
})
- _self.getMainMoment(res.data, 0)
+ _self.getMainMoment(res.data, id, 0)
})
.catch(err => {
wx.stopPullDownRefresh({})
})
},
- getMainMoment(datas, index) {
+ //获取首页栏目数据
+ getMainMoment(datas, userid, index) {
var _self = this
var count = datas.length
if (index < count) {
@@ -74,26 +160,35 @@ Page({
}), {
header: {
token: app.globalData.token
+ },
+ data: {
+ userId: userid
}
})
.then(res => {
if (res.data.length > 0) {
var tempItem = {
+ cId: datas[_self.data.curIndex].configColumnId,
+ type: datas[_self.data.curIndex].configColumnType,
name: datas[_self.data.curIndex].configColumnName,
- list: res.data
+ mode: datas[_self.data.curIndex].configTableMode,
+ list: res.data.slice(0, datas[_self.data.curIndex].configColumnRowCount)
}
_self.data.dataList.push(tempItem)
}
_self.setData({
curIndex: ++_self.data.curIndex
})
- _self.getMainMoment(datas, _self.data.curIndex)
+ _self.getMainMoment(datas, userid, _self.data.curIndex)
+
})
.catch(err => {
_self.setData({
curIndex: ++_self.data.curIndex
})
- _self.getMainMoment(datas, _self.data.curIndex)
+ if (datas[_self.data.curIndex]) {
+ _self.getMainMoment(datas, userid, _self.data.curIndex)
+ }
})
} else {
wx.hideLoading({})
@@ -140,14 +235,16 @@ Page({
case '4': //视频
var items = iem.value.split(',')
var tempList = []
- items.forEach(item => {
+ for (var i = 0; i < items.length; i++) {
+ var ss = items[i].split('&')
+ var videoUrl = app.urls.baseImgUrl + ss[0]
+ var imgUrl = app.urls.baseImgUrl + ss[1]
var tempItem = {
- id: item,
- path: app.urls.baseImgUrl + item,
- imgPath: '/images/ic_temp.png'
+ path: videoUrl,
+ imgPath: imgUrl
}
tempList.push(tempItem)
- })
+ }
iem.valueList = tempList
break
case '6':
@@ -165,6 +262,22 @@ Page({
})
iem.valueList = tempList
break
+ case '8': //单选
+ iem.dictionariesList.forEach(ss => {
+ if (iem.value.indexOf(ss.dataId) != -1) {
+ iem.selValue = ss.dataName
+ }
+ })
+ break
+ case '9': //多选
+ iem.dictionariesList.forEach(ss => {
+ if (iem.value.indexOf(ss.dataId) != -1) {
+ ss.isSel = true
+ } else {
+ ss.isSel = false
+ }
+ })
+ break
}
})
})
@@ -174,281 +287,220 @@ Page({
dataList: _self.data.dataList
})
},
- onPullDownRefresh() {
- this.setData({
- dataList: [],
- cardInfo: null,
- areaList: null
- })
- this.getDefault()
- },
- //预览图片
- viewImg(e) {
- wx.previewImage({
- urls: [e.currentTarget.dataset.url],
- })
- },
- //预览视频
- viewVideo(e) {
- var url = e.currentTarget.dataset.url
- wx.previewMedia({
- sources: [{
- url: url,
- type: 'video'
- }],
- })
- },
- play(e) {
- //进行播放
- const _self = this
- const index = e.currentTarget.dataset.index
- const idx = e.currentTarget.dataset.idx
- const ix = e.currentTarget.dataset.i
- const a = e.currentTarget.dataset.a
- var audio = e.currentTarget.dataset.item
- //先需要停止其他录音文件的播放
- _self.data.dataList.forEach(it => {
- it.list.forEach(item => {
- item.list.forEach(ix => {
- if (ix.dataType == '3') {
- if (ix.valueList) {
- ix.valueList.forEach(ii => {
- if (ii.isPlay) {
- innerAudioContext.stop()
- }
- ii.isPlay = false
- ii.curDuration = 0
- ii.curDuationStr = '00:00'
- })
- }
- }
- })
+ //获取首页基础数据 电话 微信号 地址 邮箱
+ getMainBaseUserInfo(userid) {
+ var _self = this
+ app.http.get(app.urls.getMainMoment.format({
+ configColumnId: 'de7b5e22-64f9-4c60-a1f9-6ac004dfb9a8'
+ }), {
+ header: {
+ token: app.globalData.token
+ },
+ data: {
+ userId: userid
+ }
})
+ .then(res => {
+ if (res.data.length > 0) {
+ res.data[0].list.forEach(it => {
+ switch (it.name) {
+ case 'phone':
+ _self.setData({
+ phoneTxt: it.value
+ })
+ break
+ case 'wechat':
+ _self.setData({
+ wechateTxt: it.value
+ })
+ break
+ case 'email':
+ _self.setData({
+ emailTxt: it.value
+ })
+ break
+ case 'address':
+ _self.setData({
+ addressTxt: it.value
+ })
+ break
+ }
+ })
+ }
+ })
+ .catch(err => {
+ console.log(err)
+ })
+ },
+ // 生成随机id
+ buildId: function () {
+ var chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
+
+ var nums = "";
+
+ for (var i = 0; i < 36; i++) {
+ var id = parseInt(Math.random() * 61);
+
+ nums += chars[id];
+ }
+ return nums
+ },
+ //显示详情
+ showDetail(e) {
+ var type = e.currentTarget.dataset.ctype //需要跳详情
+ if (type.indexOf('dda5007c-5fb7-48f2-8537-3cb8ea298242') != -1) {
+ //需要跳详情
+ var cId = e.currentTarget.dataset.cid
+ var uId = e.currentTarget.dataset.id
+ wx.navigateTo({
+ url: '/packagecard/moments/momentsdetail/momentsdetail?uId=' + uId + '&cId=' + cId,
+ })
+ }
+ },
+ onHide(e) {
+ this.setData({
+ isShowCard: false
})
- if (!audio.isPlay) {
- innerAudioContext = wx.createInnerAudioContext()
- innerAudioContext.src = _self.data.dataList[index].list[idx].list[ix].valueList[a].path + '.mp3'
- innerAudioContext.autoplay = true
- console.log(_self.data.dataList[index].list[idx].list[ix].valueList[a].path)
- } else {
+ if (innerAudioContext) {
innerAudioContext.stop()
}
-
-
- innerAudioContext.onPlay(() => {
- console.log('onPlay')
- _self.data.dataList[index].list[idx].list[ix].valueList[a]['isPlay'] = true
- _self.setData({
- dataList: _self.data.dataList
- })
- });
-
- innerAudioContext.onCanplay((res) => {
- // if (_self.data.waitFlag) {
- // innerAudioContext.play()
- // _self.setData({
- // waitFlag: false
- // })
- // }
- })
- innerAudioContext.onStop((res) => {
- console.log('停止播放')
- _self.data.dataList[index].list[idx].list[ix].valueList[a].isPlay = false
- _self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration = 0
- _self.data.dataList[index].list[idx].list[ix].valueList[a].curDurationStr = '00:00'
- _self.setData({
- dataList: _self.data.dataList,
- })
- innerAudioContext.destroy()
- })
- innerAudioContext.onEnded((res) => {
- console.log(res)
- console.log('播放完毕')
- _self.data.dataList[index].list[idx].list[ix].valueList[a].isPlay = false
- _self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration = 0
- _self.data.dataList[index].list[idx].list[ix].valueList[a].curDurationStr = '00:00'
- _self.setData({
- dataList: _self.data.dataList,
- })
- innerAudioContext.destroy()
- })
- innerAudioContext.onError((res) => {
- console.log('播放错误')
- console.log(res)
- _self.data.dataList[index].list[idx].list[ix].valueList[a].isPlay = false
- _self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration = 0
- _self.data.dataList[index].list[idx].list[ix].valueList[a].curDurationStr = '00:00'
- _self.setData({
- dataList: _self.data.dataList,
- })
- innerAudioContext.destroy()
- })
- innerAudioContext.onSeeking(() => {
- // console.log(innerAudioContext.currentTime)
- })
- innerAudioContext.onWaiting(() => {
- // console.log('onWaiting')
- // innerAudioContext.pause()
- // _self.setData({
- // waitFlag: true
- // })
- })
- innerAudioContext.onTimeUpdate(() => {
- if (innerAudioContext.duration != Infinity) {
- _self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration = parseInt(innerAudioContext.currentTime)
- _self.data.dataList[index].list[idx].list[ix].valueList[a].duration = parseInt(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.dataList[index].list[idx].list[ix].valueList[a].curDurationStr = curMStr + ':' + curSStr
- _self.data.dataList[index].list[idx].list[ix].valueList[a].totalDurationStr = totalMStr + ':' + totalSStr
- _self.setData({
- dataList: _self.data.dataList
- })
+ },
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function (res) {
+ var self = this
+ wx.showShareMenu({
+ withShareTicket: true,
+ success: function (res) {
+ console.log(res)
}
})
- },
- //倒退5秒
- rewind(e) {
- var _self = this
- var index = e.currentTarget.dataset.index
- var item = e.currentTarget.dataset.item
- var idx = e.currentTarget.dataset.idx
- var a = e.currentTarget.dataset.a
- var ix = e.currentTarget.dataset.i
- if (item.isPlay) {
- _self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration = _self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration - _self.data.speedStep
- innerAudioContext.seek(_self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration)
- _self.setData({
- dataList: _self.data.dataList
- })
- }
- },
- //快进5秒
- speed(e) {
- var _self = this
- var index = e.currentTarget.dataset.index
- var item = e.currentTarget.dataset.item
- var idx = e.currentTarget.dataset.idx
- var a = e.currentTarget.dataset.a
- var ix = e.currentTarget.dataset.i
- if (item.isPlay) {
- _self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration = _self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration + _self.data.speedStep
- innerAudioContext.seek(_self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration)
- _self.setData({
- dataList: _self.data.dataList
- })
- }
- },
- slider4change(e) {
- var index = e.currentTarget.dataset.index
- var item = e.currentTarget.dataset.item
- if (item.isPlay) {
- innerAudioContext.seek(e.detail.value)
- }
- },
- // 跳转模板列表
- goList: function () {
- wx.navigateTo({
- url: '../cardList/cardList',
- })
- },
- // 获取个人简介
- getPersonIntro: function () {
- var self = this
- app.restAjax.get(app.restAjax.path('{personIntroUrl}app/userexpand/get/' + app.globalData.userInfo.userId, [app.personIntroUrl]), {}, {
- headers: {
- token: app.globalData.token
- }
- }, function (code, data) {
- self.setData({
- personIntro: data
- })
- }, function (code, data) {
- app.dialog.msg(data.msg);
- });
- },
- // 获取用户信息
- getUserInfo: function () {
- var self = this
- app.restAjax.get(app.restAjax.path('{loginUrl}app/user/get-app-user', [app.personIntroUrl]), {}, {
- headers: {
- token: app.globalData.token
- }
- }, function (code, data) {
- app.globalData.userInfo = data
- self.getList()
+ if (res.from == 'button') {
+ var postId = self.buildId()
+ self.shareRecord(postId)
- }, function (code, data) {
- app.dialog.msg(data.msg);
- });
+ var param = '/pages/index/index?cardTemplateDispatchId=' + postId;
+ return {
+ title: '名片分享',
+ path: param,
+ imageUrl: self.data.shareImgUrl
+ }
+ // return返回 title 转发标题 path 路径 imageUrl 自定义图片,可以本地路径 代码包文件路径 支持png jpg 显示长宽比5:4
+ }
},
- // 获取名片
- getCard: function () {
+ // 转发记录
+ shareRecord: function (cardTemplateDispatchId) {
var self = this
- app.http.get(app.urls.shareCard.format({
- cardTemplateUseId: self.data.cardTemplateUseId
- }), {
+ app.http.post(app.urls.shareRecord, {
header: {
token: app.globalData.token
},
- data: {}
+ data: {
+ cardTemplateUseId: self.data.cardInfo.cardTemplateUseId,
+ cardTemplateDispatchParentId: '',
+ cardTemplateDispatchId: cardTemplateDispatchId
+ }
}).then(res => {
- var area = res.data.areaList
- for (let i = 0; i < area.length; i++) {
- if (area[i].templateAreaFontCenter == '1') {
- area[i].templateAreaFontCenter = 'left'
- } else if (area[i].templateAreaFontCenter == '2') {
- area[i].templateAreaFontCenter = 'center'
- } else {
- area[i].templateAreaFontCenter = 'right'
- }
- if (area[i].templateAreaFontBold == '0') {
- area[i].templateAreaFontBold = 'normal'
- } else if (area[i].templateAreaFontBold == '1') {
- area[i].templateAreaFontBold = 'bold'
- } else {
- area[i]['templateAreaFontStyle'] = 'italic'
- }
- if (area[i].templateAreaSource == 'phone') {
- self.setData({
- phoneTxt: area[i].templateAreaFontValue
- })
- } else if (area[i].templateAreaSource == 'wechat') {
- self.setData({
- wechatTxt: area[i].templateAreaFontValue
- })
- } else if (area[i].templateAreaSource == 'email') {
- self.setData({
- emailTxt: area[i].templateAreaFontValue
- })
- } else if (area[i].templateAreaSource == 'address') {
- self.setData({
- addressTxt: area[i].templateAreaFontValue
- })
- } else if (area[i].templateAreaSource == 'name') {
- self.setData({
- nameTxt: area[i].templateAreaFontValue
- })
- }
- }
self.setData({
- cardInfo: res.data,
- areaList: area,
- dataList: []
+ shareRecordId: res.data.data
})
- if (res.data) {
- self.getBrowCardUserList(res.data.cardTemplateUseId)
- self.getMainColumn(res.data.creator)
- }
})
},
+ // 展示名片码
+ showBarCode: function () {
+ this.setData({
+ isShowBarCode: true
+ })
+ wx.hideTabBar()
+ },
+ // 隐藏名片码
+ hideBarCode: function () {
+ this.setData({
+ isShowBarCode: false
+ })
+ wx.showTabBar()
+ },
+ // 获取转发数
+ getForwardCount: function () {
+ var self = this
+ app.restAjax.get(app.restAjax.path('{cardUrl}app/templateforwardingrecord/count', [app.cardUrl]), {
+ templateUseId: self.data.cardInfo.cardPersonId
+ }, {
+ headers: {
+ token: app.globalData.token
+ }
+ }, function (code, data) {
+ self.setData({
+ forwardCount: data.data
+ })
+ }, function (code, data) {
+ app.dialog.msg(data.msg);
+ });
+ },
+ // 复制文本
+ copyText: function (e) {
+ var self = this
+ var text = e.currentTarget.dataset.text
+ if (text) {
+ wx.setClipboardData({
+ data: text,
+ success: function () {}
+ })
+ }
+ },
+ // 加入卡包
+ includedCard: function () {
+ var self = this
+ app.http.post(app.urls.includedCard, {
+ header: {
+ token: app.globalData.token
+ },
+ data: {
+ cardTemplateUseBagId: "",
+ cardTemplateUseId: self.data.cardInfo.cardTemplateUseId,
+ cardTemplateUseStar: "",
+ cardTemplateUseTag: "",
+ cardTemplateUseTop: ""
+ }
+ }).then(res => {
+ console.log(res.data)
+ wx.showToast({
+ title: '加入卡包成功!',
+ })
+ })
+ .catch(err => {
+
+ })
+ },
+ // 拨打电话
+ makeCall: function () {
+ var self = this
+ var phone = self.data.phoneTxt
+ if (phone) {
+ wx.makePhoneCall({
+ phoneNumber: phone,
+ })
+ }
+ },
+ // 获取浏览数
+ getViewCount: function () {
+ var self = this
+ app.restAjax.get(app.restAjax.path('{cardUrl}app/templateviewrecord/getByTemplateUseId/' + self.data.cardInfo.cardPersonId, [app.cardUrl]), {}, {
+ headers: {
+ token: app.globalData.token
+ }
+ }, function (code, data) {
+ self.setData({
+ viewInfo: data
+ })
+ }, function (code, data) {
+ if (data.msg) {
+ app.dialog.msg(data.msg);
+ }
+ });
+ },
//获取浏览当前名片的用户头像列表
getBrowCardUserList(id) {
var _self = this
@@ -481,217 +533,140 @@ Page({
mobilePhoneNumber: self.data.phoneNum
})
},
- // 加入卡包
- includedCard: function () {
- var self = this
- app.http.post(app.urls.includedCard, {
- header: {
- token: self.data.token
- },
- data: {
- cardTemplateUseBagId: "",
- cardTemplateUseId: self.data.cardInfo.cardTemplateUseId,
- cardTemplateUseStar: "",
- cardTemplateUseTag: "",
- cardTemplateUseTop: ""
- }
- }).then(res => {
- console.log(res.data)
- if (res.statusCode == '200') {
- wx.showToast({
- title: '加入卡包成功!',
- })
- }
+ //预览图片
+ viewImg(e) {
+ wx.previewImage({
+ urls: [e.currentTarget.dataset.url],
})
},
- // 拨打电话
- makeCall: function () {
- var self = this
- var phone = self.data.phoneTxt
- if (phone) {
- wx.makePhoneCall({
- phoneNumber: phone,
- })
- }
+ //预览视频
+ viewVideo(e) {
+ var url = e.currentTarget.dataset.url
+ wx.previewMedia({
+ sources: [{
+ url: url,
+ type: 'video'
+ }],
+ })
},
- // 获取浏览数
- getViewCount: function () {
- var self = this
- app.restAjax.get(app.restAjax.path('{cardUrl}app/templateviewrecord/getByTemplateUseId/' + self.data.cardInfo.cardPersonId, [app.cardUrl]), {}, {
- headers: {
- token: app.globalData.token
- }
- }, function (code, data) {
- self.setData({
- viewInfo: data
- })
- }, function (code, data) {
- if (data.msg) {
- app.dialog.msg(data.msg);
- }
- });
- },
- // 获取转发数
- getForwardCount: function () {
- var self = this
- app.restAjax.get(app.restAjax.path('{cardUrl}app/templateforwardingrecord/count', [app.cardUrl]), {
- templateUseId: self.data.cardInfo.cardPersonId
- }, {
- headers: {
- token: app.globalData.token
- }
- }, function (code, data) {
- self.setData({
- forwardCount: data.data
- })
- }, function (code, data) {
- app.dialog.msg(data.msg);
- });
- },
- // 复制文本
- copyText: function (e) {
- var self = this
- var text = e.currentTarget.dataset.text
- if (text) {
- wx.setClipboardData({
- data: text,
- success: function () {}
- })
- }
- },
- // 获取头像
- checkPermission() {
- var _self = this
- try {
- var names = wx.getStorageSync('name')
- var icon = wx.getStorageSync('userIcon')
-
- if (names) {
- this.setData({
- name: names,
- userIcon: icon
- })
- } else {
- wx.showModal({
- title: '提示',
- content: '小程序需要您微信头像以及昵称用于展示,请授权.',
- showCancel: false,
- success(res) {
- if (res.confirm) {
- _self.getUserProfile(3)
+ play(e) {
+ //进行播放
+ const _self = this
+ const index = e.currentTarget.dataset.index
+ const idx = e.currentTarget.dataset.idx
+ const ix = e.currentTarget.dataset.i
+ const a = e.currentTarget.dataset.a
+ var audio = e.currentTarget.dataset.item
+ console.log(_self.data.isPlayAudio)
+ if (_self.data.isPlayAudio) {
+ //有播放的
+ //先需要停止其他录音文件的播放
+ _self.data.dataList.forEach(it => {
+ it.list.forEach(item => {
+ item.list.forEach(ix => {
+ if (ix.dataType == '3') {
+ if (ix.valueList) {
+ ix.valueList.forEach(ii => {
+ ii.isPlay = false
+ ii.curDuration = 0
+ ii.curDuationStr = '00:00'
+ })
+ }
}
- }
+ })
})
+ })
+ _self.setData({
+ dataList: _self.data.dataList
+ })
+ innerAudioContext.stop()
+ if (_self.data.audioId != audio.id) {
+ wx.showLoading({
+ title: '加载中...',
+ })
+ setTimeout(function () {
+ wx.hideLoading({})
+ innerAudioContext.src = _self.data.dataList[index].list[idx].list[ix].valueList[a].path + '.mp3'
+ innerAudioContext.startTime = 0
+ innerAudioContext.autoplay = true
+ _self.data.dataList[index].list[idx].list[ix].valueList[a]['isPlay'] = true
+ _self.setData({
+ dataList: _self.data.dataList,
+ isPlayAudio: true,
+ audioId: audio.id
+ })
+ }, 1500)
}
- } catch (error) {
- wx.showToast({
- title: '获取信息失败',
- icon: 'error'
+ } else {
+ //没有播放的
+ innerAudioContext.src = _self.data.dataList[index].list[idx].list[ix].valueList[a].path + '.mp3'
+ innerAudioContext.startTime = 0
+ innerAudioContext.autoplay = true
+ innerAudioContext.play()
+ _self.data.dataList[index].list[idx].list[ix].valueList[a]['isPlay'] = true
+ _self.setData({
+ dataList: _self.data.dataList,
+ isPlayAudio: true,
+ audioId: audio.id
+ })
+ }
+ innerAudioContext.onPlay(() => {
+
+ });
+
+ innerAudioContext.onCanplay((res) => {})
+ innerAudioContext.onStop((res) => {
+ console.log('onStop===')
+ _self.data.dataList[index].list[idx].list[ix].valueList[a].isPlay = false
+ _self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration = 0
+ _self.data.dataList[index].list[idx].list[ix].valueList[a].curDurationStr = '00:00'
+ _self.setData({
+ dataList: _self.data.dataList,
+ isPlayAudio: false
+ })
+ })
+ innerAudioContext.onEnded((res) => {
+ console.log(res)
+ console.log('播放完毕')
+ _self.data.dataList[index].list[idx].list[ix].valueList[a].isPlay = false
+ _self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration = 0
+ _self.data.dataList[index].list[idx].list[ix].valueList[a].curDurationStr = '00:00'
+ _self.setData({
+ dataList: _self.data.dataList,
+ isPlayAudio: false
+ })
+ })
+ innerAudioContext.onError((res) => {
+ console.log('播放错误')
+ console.log(res)
+ _self.data.dataList[index].list[idx].list[ix].valueList[a].isPlay = false
+ _self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration = 0
+ _self.data.dataList[index].list[idx].list[ix].valueList[a].curDurationStr = '00:00'
+ _self.setData({
+ dataList: _self.data.dataList,
+ isPlayAudio: false
+ })
+ })
+ innerAudioContext.onSeeking(() => {
+ // console.log(innerAudioContext.currentTime)
+ })
+ },
+
+ // 跳转模板列表
+ goList: function () {
+ wx.navigateTo({
+ url: '/packagecard/cardList/cardList',
+ })
+ },
+ //显示更多栏目数据
+ showMore(e) {
+ var item = e.currentTarget.dataset.item
+ if (item.mode == '2') {
+ var userid = e.currentTarget.dataset.userid
+ var idx = e.currentTarget.dataset.idx
+ wx.navigateTo({
+ url: '/packagecard/moments/showlist/showlist?id=' + item.cId + '&userId=' + userid + '&index=' + idx,
})
}
},
- getUserProfile(e) {
- let _self = this
- wx.getUserProfile({
- desc: '获取微信头像以及昵称用于展示',
- success: (res) => {
- wx.setStorage({
- data: res.userInfo.nickName,
- key: 'name',
- })
- wx.setStorage({
- data: res.userInfo.avatarUrl,
- key: 'userIcon',
- })
- _self.setData({
- name: res.userInfo.nickName,
- userIcon: res.userInfo.avatarUrl
- })
- app.globalData.userIcon = res.userInfo.avatarUrl
- _self.selectComponent('#head').refreshCart()
- },
- fail(err) {
- //判断是否绑定手机号
- wx.showToast({
- title: '获取个人信息失败',
- icon: 'error',
- })
- }
- })
- },
- // 生成随机id
- buildId: function () {
- var chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
-
- var nums = "";
-
- for (var i = 0; i < 36; i++) {
- var id = parseInt(Math.random() * 61);
-
- nums += chars[id];
- }
- return nums
- },
- // 展示名片码
- showBarCode: function () {
- this.setData({
- isShowBarCode: true
- })
- wx.hideTabBar()
- },
- // 隐藏名片码
- hideBarCode: function () {
- this.setData({
- isShowBarCode: false
- })
- wx.showTabBar()
- },
- // 转发记录
- shareRecord: function (cardTemplateDispatchId) {
- var self = this
- app.http.post(app.urls.shareRecord, {
- header: {
- token: app.globalData.token
- },
- data: {
- cardTemplateUseId: self.data.cardInfo.cardTemplateUseId,
- cardTemplateDispatchParentId: '',
- cardTemplateDispatchId: cardTemplateDispatchId
- }
- }).then(res => {
- console.log(res.data)
- self.setData({
- shareRecordId: res.data.data
- })
- })
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function (res) {
- console.log(res)
- var self = this
- wx.showShareMenu({
- withShareTicket: true,
- success: function (res) {
- console.log(res)
- }
- })
-
- if (res.from == 'button') {
- var postId = self.buildId()
- self.shareRecord(postId)
-
- var param = '/pages/index/index?cardTemplateDispatchId=' + postId;
- return {
- title: '我的名片',
- path: param
- }
- }
- },
- onShow() {
- if (app.globalData.token != '') {
- this.getDefault()
- }
- }
})
\ No newline at end of file
diff --git a/pages/mine/otherCard/othercarddetail.wxml b/pages/mine/otherCard/othercarddetail.wxml
index 1f4d8b9..5299c2d 100644
--- a/pages/mine/otherCard/othercarddetail.wxml
+++ b/pages/mine/otherCard/othercarddetail.wxml
@@ -1,8 +1,7 @@
-
+
{{nameTxt}}
-
@@ -14,19 +13,8 @@
-
-
- {{item.templateAreaFontValue}}
-
-
-
-
-
+
+
diff --git a/pages/mine/otherCard/othercarddetail.wxss b/pages/mine/otherCard/othercarddetail.wxss
index 32f3cdb..255a2de 100644
--- a/pages/mine/otherCard/othercarddetail.wxss
+++ b/pages/mine/otherCard/othercarddetail.wxss
@@ -413,9 +413,8 @@ page {
justify-content: space-between;
padding-left: 40rpx;
width: 100%;
- margin-top: 40rpx;
padding-top: 40rpx;
- padding-bottom: 30rpx;
+ padding-bottom: 20rpx;
background-color: #fff;
}
@@ -452,6 +451,7 @@ page {
.good-avatar image {
width: 100%;
height: 100%;
+ border-radius: 50%;
}
.good-click image {