Compare commits
288 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 365c797e28 | |||
| a50daa3326 | |||
| d47a2b7740 | |||
| e405a2bd2b | |||
|
|
42b5488a52 | ||
|
|
99ab0696ba | ||
|
|
02d289b31d | ||
| ab87f8822b | |||
| 6945c21f10 | |||
|
|
1529dcb6e6 | ||
|
|
da02e25fd1 | ||
|
|
005ae548a8 | ||
|
|
c330638827 | ||
|
|
812bb07e1e | ||
|
|
b139bf1224 | ||
|
|
5757c4bce3 | ||
|
|
8aab721c0e | ||
|
|
2d76a8ea63 | ||
|
|
dfd9fb1b67 | ||
| ee6e4102b6 | |||
|
9e8d4d4b58
|
|||
| 055cdb654a | |||
|
|
e2e5cf8b42 | ||
| 2f1b89c6a6 | |||
|
|
841dc290b2 | ||
| 0610a0b157 | |||
|
|
49fe886234 | ||
| 0f26f6737b | |||
|
fb5c8aa476
|
|||
| a732778481 | |||
|
|
2d7922ff96 | ||
| 5b3dbd1dc2 | |||
|
880ce7487b
|
|||
| a6a65153ea | |||
|
c77a7a4d5b
|
|||
|
32bcfb92e1
|
|||
|
100d4d67b9
|
|||
| a1d9339948 | |||
|
a4fee4682f
|
|||
|
f74c8a8776
|
|||
| 2f62fde4f6 | |||
|
|
905ae3b9da | ||
| 341d733a16 | |||
|
|
c02acd7259 | ||
| aa0d7a4a06 | |||
|
45b6086398
|
|||
| f81ce05547 | |||
|
fb81800253
|
|||
|
1f6d2b4ab3
|
|||
|
52277be0c9
|
|||
|
391fda5abc
|
|||
| f770b05dcd | |||
|
6d3d176cd8
|
|||
| 909082f7ca | |||
|
|
dadb891236 | ||
| 42e3c7d6a7 | |||
|
8434b1e611
|
|||
|
a0ccf26c99
|
|||
| 541d8f9f6e | |||
| 5f56b7a27c | |||
|
0c41f85630
|
|||
|
0087c0c3cd
|
|||
|
|
c270f238bd | ||
| 5add00c60a | |||
|
c236af5986
|
|||
|
d86dc49da2
|
|||
|
4c8309ca66
|
|||
|
e173f3c2a8
|
|||
|
d0107c5729
|
|||
| 1309fec9c3 | |||
|
b2d7ae4ec5
|
|||
|
|
75e02e0228 | ||
|
|
3e8caffe19 | ||
| 571489743a | |||
|
|
f7f3fee4ad | ||
| 1f70d8dfcb | |||
|
|
8c89864beb | ||
| af908a3dda | |||
| 9ee97373bc | |||
|
|
388daaa901 | ||
|
0f85f77520
|
|||
|
23916ea7fa
|
|||
| 539309b370 | |||
|
|
0824d97080 | ||
| b98baa39aa | |||
|
0619bbd901
|
|||
| 60cb9294fc | |||
|
cd89acf38c
|
|||
| c4114bcfc5 | |||
|
|
f2e3427260 | ||
| dbf18d4091 | |||
|
|
7d066ca67d | ||
| 22901579b9 | |||
|
|
3ecaac3190 | ||
|
|
c5b3505dcd | ||
| b9eceb6ecf | |||
|
2bdd8e2b7f
|
|||
| 5017534a24 | |||
|
f9f6bba08b
|
|||
| 2f103eafbe | |||
|
64824a8fb7
|
|||
| 721087e372 | |||
|
164b7f8e4c
|
|||
|
a80c2e53b8
|
|||
| f7da2d452c | |||
|
e91b35d1e3
|
|||
| 115400353f | |||
|
|
dd5a59cccb | ||
| c9b9dc1610 | |||
|
a6328358e2
|
|||
|
7c839816d4
|
|||
|
13524dcefc
|
|||
|
784cd1ec89
|
|||
|
aac975e921
|
|||
|
1305931e3b
|
|||
| 0562cfd830 | |||
|
|
14b0d68ce4 | ||
|
40e252c400
|
|||
| 5dd01ffa93 | |||
| 06bbd3d600 | |||
|
|
3097bf8b91 | ||
|
c5305c5a72
|
|||
|
4e02daa854
|
|||
| 022192c9d6 | |||
|
|
94c22fdef1 | ||
| 8ce148950a | |||
|
|
e58a1a6ef6 | ||
| 6d4c9dc5a4 | |||
|
9361f5bffe
|
|||
| 3fe8f15aad | |||
|
|
84c02f90f7 | ||
| 93dfeaa36d | |||
| fc4c187702 | |||
|
84240fedb8
|
|||
| 4c3808d2ff | |||
|
|
32d23e4bb0 | ||
| 380bd7dc9c | |||
|
|
b35222853d | ||
| e07c2288dc | |||
|
2f4e938a2b
|
|||
| baf39b01e2 | |||
|
79990e56d2
|
|||
| 19187b67fc | |||
|
5fd62e4010
|
|||
| 22bc2a4b89 | |||
|
7090635886
|
|||
| 87c321be99 | |||
|
4f7fc23c23
|
|||
| 3641264d19 | |||
|
|
cf7d689ce0 | ||
| 1cc6fc56d1 | |||
|
|
d1aaa525ed | ||
|
|
8ff58e1a31 | ||
| b1c7f612f1 | |||
|
4bf837d53e
|
|||
| 5fc375e589 | |||
|
3d04824b83
|
|||
| 960f0453ec | |||
|
1cc3f289fe
|
|||
|
3884f93ad8
|
|||
| e759f15852 | |||
|
|
3e7165ef19 | ||
|
|
2bf46d983a | ||
| fd78ec19db | |||
|
f57ebac022
|
|||
|
8276bf358f
|
|||
|
67edac985e
|
|||
|
74b10f4620
|
|||
| 12d095dc05 | |||
|
|
c9c714d4e3 | ||
| 17e336f0fc | |||
|
bfa4ed6edb
|
|||
| 0e33599174 | |||
|
7755f54f07
|
|||
|
0b5892cfbd
|
|||
| ff4c3982ba | |||
|
36080fd730
|
|||
| 81ec6586e3 | |||
|
|
150c3337e4 | ||
| fbdd3f20b4 | |||
|
0b0ac462a7
|
|||
| 7c16e8c190 | |||
|
1f54899b66
|
|||
| 7e37f71d56 | |||
|
3c44ad2811
|
|||
|
186f1cdb27
|
|||
| 209cb7d9fb | |||
|
e4f917a9cf
|
|||
|
06092fb183
|
|||
| 252e4b7deb | |||
|
|
9baac8ef63 | ||
| 5b2745051e | |||
| f58cc207c4 | |||
|
192bd462d4
|
|||
| efde545104 | |||
|
b1e5b24319
|
|||
| 2ea72995a9 | |||
|
|
26c2e044dc | ||
| 5500dc9f73 | |||
|
d97b749a0a
|
|||
|
cf76518bc9
|
|||
|
8d7e4b2ce4
|
|||
| 7bfce17816 | |||
|
|
7cf5577cb0 | ||
| e33e07178d | |||
|
|
9fac4e8a2e | ||
|
|
e223fd5ff9 | ||
| d7c6625416 | |||
|
|
0a8f2f815d | ||
| 42a08e07ba | |||
| 4e350f4dd0 | |||
|
e946b98abf
|
|||
|
|
2759972de6 | ||
| bee3ab9fba | |||
|
a318ea9f84
|
|||
|
3eaee9009a
|
|||
|
|
2ab2d1c38e | ||
| d8840edb30 | |||
|
|
1d98624753 | ||
|
75a4bbedbe
|
|||
| d4a9b38f99 | |||
|
|
3b9e429c80 | ||
|
|
a9d4708d2c | ||
| 7206d00afc | |||
| 798f499263 | |||
|
|
64da585bd7 | ||
|
|
959afc776a | ||
|
f89803cf9b
|
|||
| 795726bdb8 | |||
|
|
de2b7fe26d | ||
|
|
a0e780d05b | ||
|
|
0b5fa511bf | ||
| a1cba0a7fd | |||
| 1b03d1be7e | |||
|
55695f164b
|
|||
| 084826e144 | |||
| ab4b418c8f | |||
|
56eb7e551c
|
|||
|
0279128637
|
|||
| d78b787967 | |||
| 242f22d2ce | |||
|
427442f50a
|
|||
|
641cb4a4a2
|
|||
|
78d60bd9ac
|
|||
|
217e8b51ed
|
|||
|
74a9778a62
|
|||
| e83b5b1311 | |||
|
ceb2b8084d
|
|||
|
4453742f3c
|
|||
|
93c412a515
|
|||
|
|
71a25fd11d | ||
|
|
6ec2318d0c | ||
|
|
04a4ed523f | ||
|
|
e67e2fe701 | ||
| 7d82d8d156 | |||
| c1a3a11781 | |||
|
|
80e3a721a1 | ||
|
|
31474f482f | ||
|
|
df1bad0a31 | ||
| ec2bbcdc29 | |||
| e9f0b1ba78 | |||
|
|
61756ac875 | ||
| c5e16abbc2 | |||
|
2d7ed292c0
|
|||
|
30451e2767
|
|||
| cde4e7db87 | |||
| 59df1ed10f | |||
|
385653d391
|
|||
|
|
3e45c9350a | ||
| 2ed7b6798b | |||
| f6e4562ce2 | |||
|
|
22ea59f5c5 | ||
| b9e15c1b02 | |||
|
5520e7ab7c
|
|||
|
1d9edefd7f
|
|||
|
|
5094efd41e | ||
|
|
70e848cbbb | ||
|
b605f68e72
|
|||
| 2525db391c | |||
| dbffca53c8 | |||
|
519ec0abe8
|
|||
|
|
243e1f93bd | ||
|
74fbd629d6
|
|||
| e71a43eb85 | |||
|
|
fef56d1b52 | ||
|
|
cc7a293e18 | ||
|
|
8660e95d02 | ||
|
96adf9e6a9
|
2
.gitignore
vendored
@@ -1,2 +1,4 @@
|
|||||||
.vscode
|
.vscode
|
||||||
node_modules
|
node_modules
|
||||||
|
unpackage
|
||||||
|
manifest.json
|
||||||
30
App.vue
@@ -1,18 +1,38 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
|
globalData: {
|
||||||
|
im: {}
|
||||||
|
},
|
||||||
onLaunch: function() {
|
onLaunch: function() {
|
||||||
console.log('App Launch')
|
// 禁止旋转
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
plus.screen.lockOrientation('portrait-primary');
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
getApp().globalData.im = this.imService
|
||||||
|
// console.log('App Launch');
|
||||||
|
// 缓存token
|
||||||
|
uni.getStorage({
|
||||||
|
key: "token",
|
||||||
|
success: (res) => {
|
||||||
|
// uni.switchTab({
|
||||||
|
// url: "/pages/index/index"
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
onShow: function() {
|
onShow: function() {
|
||||||
console.log('App Show')
|
// console.log('App Show');
|
||||||
},
|
},
|
||||||
onHide: function() {
|
onHide: function() {
|
||||||
console.log('App Hide')
|
// console.log('App Hide');
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
/*每个页面公共css */
|
/*每个页面公共css */
|
||||||
@import "uview-ui/index.scss";
|
/* #ifndef APP-PLUS-NVUE */
|
||||||
|
@import 'uview-ui/index.scss';
|
||||||
|
/* #endif*/
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
7
common/cos-wx-sdk-v5.js
Normal file
@@ -4,12 +4,14 @@
|
|||||||
const install = (Vue, vm) => {
|
const install = (Vue, vm) => {
|
||||||
// 此处没有使用传入的params参数
|
// 此处没有使用传入的params参数
|
||||||
let api = {
|
let api = {
|
||||||
|
// 获取标签
|
||||||
getLiveSpec(){
|
getLiveSpec(){
|
||||||
return vm.$u.get("Streaming/getLiveSpec")
|
return vm.$u.get("Streaming/getLiveSpec")
|
||||||
},
|
},
|
||||||
login({member_name,member_password}){
|
login({member_name,member_password}){
|
||||||
return vm.$u.post("Login/login",{member_name,member_password})
|
return vm.$u.get("/Login/expertLogin",{member_name,member_password})
|
||||||
},
|
},
|
||||||
|
// 创建标签
|
||||||
createLivesp({spec_name}){
|
createLivesp({spec_name}){
|
||||||
return vm.$u.post("Streaming/createLivesp",{spec_name})
|
return vm.$u.post("Streaming/createLivesp",{spec_name})
|
||||||
},
|
},
|
||||||
@@ -21,7 +23,147 @@ const install = (Vue, vm) => {
|
|||||||
},
|
},
|
||||||
liveStreamList(){
|
liveStreamList(){
|
||||||
return vm.$u.post("Streaming/liveStreamList")
|
return vm.$u.post("Streaming/liveStreamList")
|
||||||
|
},
|
||||||
|
// 获取订单列表
|
||||||
|
getorderlist({type,page}){
|
||||||
|
return vm.$u.get("/Order/orderList",{type,page})
|
||||||
|
},
|
||||||
|
// 获取试穿订单列表
|
||||||
|
getshiftlist(){
|
||||||
|
return vm.$u.get("/order/goodsTryOrderList")
|
||||||
|
},
|
||||||
|
// 获取轮播图列表
|
||||||
|
getswiper(){
|
||||||
|
return vm.$u.get("/Order/orderList")
|
||||||
|
},
|
||||||
|
// 商家登陆
|
||||||
|
shoplogin({member_name,member_password}){
|
||||||
|
return vm.$u.get("/Login/storeLogin",{member_name,member_password})
|
||||||
|
},
|
||||||
|
// 获取个人信息
|
||||||
|
getshopinfo(){
|
||||||
|
return vm.$u.post("/member/memberInfo")
|
||||||
|
},
|
||||||
|
// 获取粉丝列表
|
||||||
|
myfanlist(){
|
||||||
|
return vm.$u.post("/member/myFansList")
|
||||||
|
},
|
||||||
|
// 修改个人信息
|
||||||
|
changeinfo({nickname,avatar,signature}){
|
||||||
|
return vm.$u.post("/Member/changeMemberInfo",{nickname,avatar,signature})
|
||||||
|
},
|
||||||
|
// 获取内容列表
|
||||||
|
articlelist({type,page}){
|
||||||
|
return vm.$u.post("/Article/articleList",{type,page})
|
||||||
|
},
|
||||||
|
// 删除文章
|
||||||
|
delarticle({article_id}){
|
||||||
|
return vm.$u.post("/article/articleDelete",{article_id})
|
||||||
|
},
|
||||||
|
// 骑手列表
|
||||||
|
takeawayerlist(){
|
||||||
|
return vm.$u.get("/Order/getTakeawayerList")
|
||||||
|
},
|
||||||
|
// 投诉列表
|
||||||
|
reportlist(){
|
||||||
|
return vm.$u.post("/takeawayer/complaintTKList")
|
||||||
|
},
|
||||||
|
// 投诉详情
|
||||||
|
reportdetail({id}){
|
||||||
|
return vm.$u.post("/takeawayer/complaintInfo",{id})
|
||||||
|
},
|
||||||
|
// 可以投诉的订单
|
||||||
|
canreportorder(){
|
||||||
|
return vm.$u.post("/Takeawayer/tryOrderSnList")
|
||||||
|
},
|
||||||
|
// 投诉骑手
|
||||||
|
reportorder({order_id,takeawayer_id,order_list,content}){
|
||||||
|
return vm.$u.post("/takeawayer/complaintTakeawayer",{order_id,takeawayer_id,order_list,content})
|
||||||
|
},
|
||||||
|
// 文章详情
|
||||||
|
getdetail({article_id}){
|
||||||
|
return vm.$u.post("/article/articleInfo",{article_id})
|
||||||
|
},
|
||||||
|
// 回复评论
|
||||||
|
reply({article_id,pid,content,reply_id}){
|
||||||
|
return vm.$u.post("/article/articleAddComment",{article_id,pid,content,reply_id})
|
||||||
|
},
|
||||||
|
// 达人是否可以直播
|
||||||
|
canlive(){
|
||||||
|
return vm.$u.post("/Streaming/expt_live")
|
||||||
|
},
|
||||||
|
// 可选择直播商品列表
|
||||||
|
canselectgood(){
|
||||||
|
return vm.$u.post("/article/getStoreGoodsList")
|
||||||
|
},
|
||||||
|
// 发布图文
|
||||||
|
publishphoto({article_title,article_content,article_pic,file_id,goods_id_arr,label_arr}){
|
||||||
|
return vm.$u.post("/article/publishImage",{article_title,article_content,article_pic,file_id,goods_id_arr,label_arr})
|
||||||
|
},
|
||||||
|
// 发布视频
|
||||||
|
publishvideo({article_title,article_content,article_pic,video_path,goods_id_arr,label_arr}){
|
||||||
|
return vm.$u.post("/article/publishVideo",{article_title,article_content,article_pic,video_path,goods_id_arr,label_arr})
|
||||||
|
},
|
||||||
|
// 订单详情
|
||||||
|
orderdetail({order_id}){
|
||||||
|
return vm.$u.post("/Order/orderInfo",{order_id})
|
||||||
|
},
|
||||||
|
// 试穿订单详情
|
||||||
|
testorderdetail({goods_try_id}){
|
||||||
|
return vm.$u.post("/order/goodsTryOrderInfo",{goods_try_id})
|
||||||
|
},
|
||||||
|
// 绑定物流订单
|
||||||
|
bindpushid({store_deliver_type,order_id,shipping_code,shipping_express_id}){
|
||||||
|
return vm.$u.post("/order/send",{store_deliver_type,order_id,shipping_code,shipping_express_id})
|
||||||
|
},
|
||||||
|
// 绑定骑手
|
||||||
|
bindcarer({store_deliver_type,order_id,takeawayer_id}){
|
||||||
|
return vm.$u.post("/order/send",{store_deliver_type,order_id,takeawayer_id})
|
||||||
|
},
|
||||||
|
// 自提
|
||||||
|
bindmention({store_deliver_type,shipping_express_id,deliver_explain,order_id,sendimg}) {
|
||||||
|
return vm.$u.post("/order/send",{store_deliver_type,shipping_express_id,deliver_explain,order_id,sendimg})
|
||||||
|
},
|
||||||
|
// 发货物流公司
|
||||||
|
pushcompany(){
|
||||||
|
return vm.$u.post("/order/getExpress")
|
||||||
|
},
|
||||||
|
// 退款退货
|
||||||
|
refund({refund_id,seller_state,seller_message}){
|
||||||
|
return vm.$u.post("/order/editRefund",{refund_id,seller_state,seller_message})
|
||||||
|
},
|
||||||
|
// 试穿
|
||||||
|
agreetest({goods_try_id,type,takeawayer_id}){
|
||||||
|
return vm.$u.post("/order/goodsTryAgree",{goods_try_id,type,takeawayer_id})
|
||||||
|
},
|
||||||
|
// 物流
|
||||||
|
getcarinfo({order_id}) {
|
||||||
|
return vm.$u.post("/Order/orderLogistics",{order_id})
|
||||||
|
},
|
||||||
|
|
||||||
|
messageList({page = 1}){
|
||||||
|
return vm.$u.post("/message/messageList",{page})
|
||||||
|
},
|
||||||
|
isread(){
|
||||||
|
return vm.$u.post("/message/isread")
|
||||||
|
},
|
||||||
|
messageInfo({id}){
|
||||||
|
return vm.$u.post("/message/messageInfo",{id})
|
||||||
|
},
|
||||||
|
// 达人验证码
|
||||||
|
getCode({member_mobile,smslog_type=2}) {
|
||||||
|
return vm.$u.post("/Sms/sendSmsCode",{member_mobile,smslog_type})
|
||||||
|
},
|
||||||
|
// 达人登录
|
||||||
|
starLogin({member_mobile,sms_code}) {
|
||||||
|
return vm.$u.post("/Login/platformExpertPhoneLogin",{member_mobile,sms_code})
|
||||||
|
},
|
||||||
|
//上传直播间人数
|
||||||
|
//https://mall.dmygkeji.com/storeapi/Streaming/changeLiveRealtimeNumber?live_id=1&realtime_number=10
|
||||||
|
changeLiveRealtimeNumber({id,number}){
|
||||||
|
return vm.$u.post("Streaming/changeLiveRealtimeNumber",{live_id:id,realtime_number:number})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
|
// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
|
||||||
vm.$u.api = api;
|
vm.$u.api = api;
|
||||||
|
|||||||
@@ -1,20 +1,21 @@
|
|||||||
const install = (Vue, vm) => {
|
const install = (Vue, vm) => {
|
||||||
// 此为自定义配置参数,具体参数见上方说明
|
// 此为自定义配置参数,具体参数见上方说明
|
||||||
Vue.prototype.$u.http.setConfig({
|
Vue.prototype.$u.http.setConfig({
|
||||||
baseUrl: 'https://dmmall.sdbairui.com//storeapi',
|
baseUrl: 'https://mall.dmygkeji.com/storeapi',
|
||||||
loadingText: '努力加载中~',
|
loadingText: '努力加载中~',
|
||||||
loadingTime: 800,
|
loadingTime: 800,
|
||||||
// 设置自定义头部content-type
|
originalData: true,
|
||||||
// header: {
|
|
||||||
// "Authorization" : "122"
|
|
||||||
// }
|
|
||||||
// ......
|
|
||||||
});
|
});
|
||||||
Vue.prototype.$u.http.interceptor.request = (config) => {
|
Vue.prototype.$u.http.interceptor.request = (config) => {
|
||||||
const token = uni.getStorageSync('token');
|
const token = uni.getStorageSync('token');
|
||||||
config.header.Authorization = 'Bearer' + " " + token;
|
config.header.Authorization = 'Bearer' + " " + token;
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
Vue.prototype.$u.http.interceptor.response = (res) => {
|
||||||
|
// todo 判断状态码
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
63
components/GoEasyAudioPlayer/GoEasyAudioPlayer.vue
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
<template>
|
||||||
|
<div class="goeasy-audio-player" @click="playAudio">
|
||||||
|
<div class="audio-facade" :style="{width:Math.ceil(duration)*7 + 50 + 'px'}">
|
||||||
|
<div class="audio-facade-bg" :class="{'play-icon':play}"> </div>
|
||||||
|
<div>{{Math.ceil(duration) || 0}}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const innerAudioContext = uni.createInnerAudioContext();
|
||||||
|
export default {
|
||||||
|
name: "GoEasyAudioPlayer",
|
||||||
|
props : ['src', 'duration'],
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
play : false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods : {
|
||||||
|
playAudio () {
|
||||||
|
this.play = true;
|
||||||
|
innerAudioContext.src = this.src;
|
||||||
|
innerAudioContext.play();
|
||||||
|
setTimeout(() => {
|
||||||
|
this.play = false;
|
||||||
|
}, this.duration*1000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.goeasy-audio-player{
|
||||||
|
margin-top: 12rpx;
|
||||||
|
-webkit-tap-highlight-color:rgba(0,0,0,0);
|
||||||
|
}
|
||||||
|
.audio-facade{
|
||||||
|
min-width: 20rpx;
|
||||||
|
padding: 6rpx 10rpx;
|
||||||
|
height: 72rpx;
|
||||||
|
line-height: 72rpx;
|
||||||
|
background: #FF780F;
|
||||||
|
font-size: 24rpx;
|
||||||
|
border-radius: 14rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row-reverse;
|
||||||
|
}
|
||||||
|
.audio-facade-bg{
|
||||||
|
background: url("./images/voice.png") no-repeat center;
|
||||||
|
background-size: 30rpx;
|
||||||
|
width: 40rpx;
|
||||||
|
}
|
||||||
|
.audio-facade-bg.play-icon{
|
||||||
|
background: url("./images/play.gif") no-repeat center;
|
||||||
|
background-size: 30rpx;
|
||||||
|
-moz-transform:rotate(180deg);
|
||||||
|
-webkit-transform:rotate(180deg);
|
||||||
|
-o-transform:rotate(180deg);
|
||||||
|
transform:rotate(180deg);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
BIN
components/GoEasyAudioPlayer/images/play.gif
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
components/GoEasyAudioPlayer/images/play.gif.7z
Normal file
BIN
components/GoEasyAudioPlayer/images/voice.png
Normal file
|
After Width: | Height: | Size: 300 B |
55
components/GoEasyVideoPlayer/GoEasyVideoPlayer.vue
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<template>
|
||||||
|
<video
|
||||||
|
v-if="show"
|
||||||
|
class="video-player"
|
||||||
|
controls = ""
|
||||||
|
@play="onPlayStart"
|
||||||
|
id="videoPlayer"
|
||||||
|
autoplay="true"
|
||||||
|
@fullscreenchange="onVideoFullScreenChange"
|
||||||
|
:src="url">
|
||||||
|
</video>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "GoEasyVideoPlayer",
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
show : false,
|
||||||
|
context: null,
|
||||||
|
url: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods : {
|
||||||
|
play (video) {
|
||||||
|
this.show = true;
|
||||||
|
this.url = video.url;
|
||||||
|
this.context = uni.createVideoContext('videoPlayer');
|
||||||
|
},
|
||||||
|
onVideoFullScreenChange (e) {
|
||||||
|
//当退出全屏播放时,隐藏播放器
|
||||||
|
if(this.show && !e.detail.fullScreen){
|
||||||
|
this.show = false;
|
||||||
|
this.context.stop();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onPlayStart () {
|
||||||
|
//播放开始时,立即全屏
|
||||||
|
this.context.requestFullScreen({
|
||||||
|
direction : 0
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.video-player{
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
BIN
components/GoEasyVideoPlayer/images/play.png
Normal file
|
After Width: | Height: | Size: 560 B |
@@ -1,12 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<image></image>
|
<image :src="info.complain_goods_image"></image>
|
||||||
<view class="people">
|
<view class="people">
|
||||||
<view class="status">已受理</view>
|
<view class="status">{{info.complain_status==0?"未受理":"已审核"}}</view>
|
||||||
<view class="goods-name u-line-1">心机小黑裙连衣裙赫本风夏季爆款...</view>
|
<view class="goods-name u-line-1">{{info.complain_goods_name}}</view>
|
||||||
<view class="info">
|
<view class="info">
|
||||||
<view class="name">骑手:李先生</view>
|
<view class="name">骑手:{{info.takeawayer_name}}</view>
|
||||||
<view class="price">¥199.9</view>
|
<view class="price">¥{{info.complain_goods_price*info.complain_goods_num}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -16,8 +16,14 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {}
|
return {}
|
||||||
},
|
},
|
||||||
methods: {
|
props: {
|
||||||
|
info:{
|
||||||
|
type: Object,
|
||||||
|
default: null
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@@ -35,7 +41,6 @@ export default {
|
|||||||
height: 160rpx;
|
height: 160rpx;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
margin-right: 25rpx;
|
margin-right: 25rpx;
|
||||||
background-color: aqua;
|
|
||||||
}
|
}
|
||||||
.people {
|
.people {
|
||||||
.status {
|
.status {
|
||||||
|
|||||||
@@ -1,24 +1,24 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="content-item">
|
<view class="content-item">
|
||||||
<view class="image">
|
<view class="image" @click="toDetailsPage">
|
||||||
<image class="cover"></image>
|
<image class="cover" :src="info.article_pic" alt="没有图片"></image>
|
||||||
<image src="/static/image/user/5.png" class="play-icon" v-if="cur==1"></image>
|
<image src="/static/image/user/5.png" class="play-icon" v-if="type==2"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="right" @click="toDetailsPage">
|
<view class="right" >
|
||||||
<u-icon name="close" color="#999999" size="27" @click.stop="showPopup"></u-icon>
|
<u-icon name="close" color="#999999" size="27" @click="showPopup(info.article_id)"></u-icon>
|
||||||
<view class="tags u-line-2">#配饰就该这么搭#</view>
|
<view class="tags u-line-2" @click="toDetailsPage">{{info.article_title}}</view>
|
||||||
<view class="data">
|
<view class="data">
|
||||||
<view>
|
<view>
|
||||||
<image src="/static/image/user/2.png"></image>
|
<image src="/static/image/user/2.png"></image>
|
||||||
<text>2.5w</text>
|
<text>{{info.comment_num}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<image src="/static/image/user/3.png"></image>
|
<image src="/static/image/user/3.png"></image>
|
||||||
<text>2.5w</text>
|
<text>{{info.collect_num}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<image src="/static/image/user/4.png"></image>
|
<image src="/static/image/user/4.png"></image>
|
||||||
<text>2.5w</text>
|
<text>{{info.like_num}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -30,19 +30,27 @@ export default {
|
|||||||
return {}
|
return {}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
cur: [Number, String],
|
info:{
|
||||||
|
type: Object,
|
||||||
|
default: null
|
||||||
|
},
|
||||||
|
type:{
|
||||||
|
type: Number,
|
||||||
|
default: 1
|
||||||
|
},
|
||||||
delItem: {
|
delItem: {
|
||||||
type: Function,
|
type: Function,
|
||||||
default: null
|
default: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
showPopup() {
|
showPopup(id) {
|
||||||
this.delItem();
|
console.log(12345,id)
|
||||||
|
this.$emit("del",id)
|
||||||
},
|
},
|
||||||
toDetailsPage() {
|
toDetailsPage() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/user/contentDetails?current=' + this.cur
|
url: '/pages/user/contentDetails?current=' + this.type+'&id=' + this.info.article_id
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -61,7 +69,7 @@ export default {
|
|||||||
width: 160rpx;
|
width: 160rpx;
|
||||||
height: 160rpx;
|
height: 160rpx;
|
||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
background-color: aqua;
|
// background-color: aqua;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
.play-icon {
|
.play-icon {
|
||||||
|
|||||||
@@ -1,15 +1,18 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="fans-item">
|
<view class="fans-item">
|
||||||
<image></image>
|
<image :src="info.friend_frommavatar"></image>
|
||||||
<view class="name">兽兽</view>
|
<view class="name">{{info.fromMemberNickname}}</view>
|
||||||
<view class="date">2017-10-14</view>
|
<view class="date">{{info.fromMemberFriendAddtime}}</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {}
|
return {}
|
||||||
}
|
},
|
||||||
|
props: {
|
||||||
|
info: Object
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@@ -1,12 +1,26 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="item" @click="toDetailsPage">
|
<view class="item" @click="toDetailsPage">
|
||||||
<image></image>
|
<image :src="info.extend_order_goods[0].goods_image"></image>
|
||||||
<view class="goods">
|
<view class="goods">
|
||||||
<view class="status" v-if="cur==4">待处理订单</view>
|
<view class="box">
|
||||||
<view class="name u-line-1">心机小黑裙连衣裙赫本风夏季爆款...</view>
|
<view class="">
|
||||||
|
编号:{{info.order_sn}}
|
||||||
|
</view>
|
||||||
|
<!-- 1待处理 2已发货 3已完成 4申请退款 5已退款 6拒绝退款 -->
|
||||||
|
<view class="status" v-if="info.view_type==1">待处理订单</view>
|
||||||
|
<view class="status" v-else-if="info.view_type==2">已发货订单</view>
|
||||||
|
<view class="status" v-else-if="info.view_type==3">已完成订单</view>
|
||||||
|
<view class="status" v-else-if="info.view_type==4">申请退款</view>
|
||||||
|
<view class="status" v-else-if="info.view_type==5">已退款订单</view>
|
||||||
|
<view class="status" v-else-if="info.view_type==6">商家同意</view>
|
||||||
|
<view class="status" v-else-if="info.view_type==7">商家拒绝</view>
|
||||||
|
<view class="status" v-else-if="info.view_type==10">待支付订单</view>
|
||||||
|
</view>
|
||||||
|
<view class="name u-line-1">{{info.extend_order_goods[0].goods_name}}</view>
|
||||||
<view class="info">
|
<view class="info">
|
||||||
<view class="num">共一件商品</view>
|
<view class="num">共{{info.count_number}}件商品</view>
|
||||||
<view class="price">实付<span>¥199.9</span></view>
|
<view class="price">{{ info.view_type==10 ? "待支付" : "实付" }}<span>¥{{info.order_amount}}</span></view>
|
||||||
|
<view class="time">{{ info.view_type==10 ? info.add_time.slice(5,16) : info.payment_time.slice(5,16) }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -17,12 +31,13 @@ export default {
|
|||||||
return {}
|
return {}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
cur: [Number, String]
|
cur: [Number, String],
|
||||||
|
info: Object
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
toDetailsPage() {
|
toDetailsPage() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/index/details?current=' + this.cur
|
url: '/pages/index/details?id=' + this.info.order_id+"&type="+this.info.view_type
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -35,24 +50,30 @@ export default {
|
|||||||
height: 220rpx;
|
height: 220rpx;
|
||||||
background: rgba(255,255,255,1);
|
background: rgba(255,255,255,1);
|
||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
padding: 30rpx;
|
padding: 20rpx 10rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
> image {
|
> image {
|
||||||
width: 160rpx;
|
width: 160rpx;
|
||||||
height: 160rpx;
|
height: 160rpx;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
margin-right: 25rpx;
|
margin-right: 20rpx;
|
||||||
background-color: aqua;
|
|
||||||
}
|
}
|
||||||
.goods {
|
.goods {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
.box{
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
.status {
|
.status {
|
||||||
|
width: 120rpx;
|
||||||
align-self: flex-end;
|
align-self: flex-end;
|
||||||
font-size: 26rpx;
|
font-size: 24rpx;
|
||||||
color: rgba(255,49,49,1);
|
color: rgba(255,49,49,1);
|
||||||
margin-bottom: 30rpx;
|
margin-bottom: 30rpx;
|
||||||
}
|
}
|
||||||
@@ -63,9 +84,10 @@ export default {
|
|||||||
margin-bottom: 30rpx;
|
margin-bottom: 30rpx;
|
||||||
}
|
}
|
||||||
.info {
|
.info {
|
||||||
width: 100%;
|
width: 470rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
color: rgba(102,102,102,1);
|
color: rgba(102,102,102,1);
|
||||||
.price {
|
.price {
|
||||||
@@ -75,6 +97,9 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.time {
|
||||||
|
font-size: 20rpx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
112
components/order-item/testlist.vue
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
<template>
|
||||||
|
<view class="item" @click="toDetailsPage">
|
||||||
|
<image :src="info.goods_pic"></image>
|
||||||
|
<view class="goods">
|
||||||
|
<view class="box">
|
||||||
|
<view class="boxid">
|
||||||
|
{{info.goods_try_id}}
|
||||||
|
</view>
|
||||||
|
<!-- 0:待处理订单 20:同意 40:拒绝此订单 -->
|
||||||
|
<view class="status" v-if="info.goods_try_order_status==0">待处理订单</view>
|
||||||
|
<view class="status" v-if="info.goods_try_order_status==20">已接单订单</view>
|
||||||
|
<view class="status" v-if="info.goods_try_order_status==40">已拒绝订单</view>
|
||||||
|
<view class="status" v-if="info.goods_try_order_status==50">已完成订单</view>
|
||||||
|
</view>
|
||||||
|
<view class="name u-line-1">{{info.goods_name}}</view>
|
||||||
|
<view class="info">
|
||||||
|
<view class="num">共{{info.goods_try_num}}件商品</view>
|
||||||
|
<view class="price">实付<span>¥{{info.price}}</span></view>
|
||||||
|
<!-- <view class="time">{{ info.payment_time.slice(5,16) }}</view> -->
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {}
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
cur: [Number, String],
|
||||||
|
info: Object
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
toDetailsPage() {
|
||||||
|
let type =0
|
||||||
|
let info = this.info
|
||||||
|
if(info.is_delete == 1){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
if(info.goods_try_order_status==0){
|
||||||
|
type=1
|
||||||
|
}else if(info.goods_try_order_status==20){
|
||||||
|
type=2
|
||||||
|
}else if(info.goods_try_order_status==40){
|
||||||
|
type=3
|
||||||
|
}else if(info.goods_try_order_status==50){
|
||||||
|
type=4
|
||||||
|
}
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/index/otherdetails?id=' + this.info.goods_try_id+"&type="+type
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.item {
|
||||||
|
margin: 0 auto 20rpx;
|
||||||
|
width: 690rpx;
|
||||||
|
height: 220rpx;
|
||||||
|
background: rgba(255,255,255,1);
|
||||||
|
border-radius: 10rpx;
|
||||||
|
padding: 30rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
> image {
|
||||||
|
width: 160rpx;
|
||||||
|
height: 160rpx;
|
||||||
|
flex-shrink: 0;
|
||||||
|
margin-right: 25rpx;
|
||||||
|
}
|
||||||
|
.goods {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: space-between;
|
||||||
|
.box{
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
.boxid{
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.status {
|
||||||
|
align-self: flex-end;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: rgba(255,49,49,1);
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
}
|
||||||
|
.name {
|
||||||
|
width: 439rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: rgba(51,51,51,1);
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
}
|
||||||
|
.info {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: rgba(102,102,102,1);
|
||||||
|
.price {
|
||||||
|
margin-left: 10rpx;
|
||||||
|
> span {
|
||||||
|
color: #FF780F;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -18,12 +18,19 @@ export default {
|
|||||||
xuanzhong:false,
|
xuanzhong:false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props:['image','title','price','num','sid'],
|
props:['image','title','price','num','sid','wxuanzhong'],
|
||||||
methods:{
|
methods:{
|
||||||
xuanzhongs(){
|
xuanzhongs(){
|
||||||
this.xuanzhong = !this.xuanzhong
|
this.xuanzhong = !this.xuanzhong
|
||||||
this.$emit("xuanzhong")
|
this.$emit("xuanzhong")
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
watch:{
|
||||||
|
|
||||||
|
},
|
||||||
|
created(){
|
||||||
|
this.xuanzhong = this.wxuanzhong
|
||||||
|
console.log(this.wxuanzhong)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -2,10 +2,16 @@
|
|||||||
<view id="release">
|
<view id="release">
|
||||||
<!-- 标签 -->
|
<!-- 标签 -->
|
||||||
<view>
|
<view>
|
||||||
<view class="titles">标签</view>
|
<view class="titles flex-title">
|
||||||
|
<text>标签</text>
|
||||||
|
<text @click="editing">{{ is_edit ? "取消编辑" : "编辑" }}</text>
|
||||||
|
</view>
|
||||||
<view class="form-view" @click="show_add()">+ 新建标签</view>
|
<view class="form-view" @click="show_add()">+ 新建标签</view>
|
||||||
<view class="form-view" :class=" {'cur': rSelect.indexOf(item.id)!=-1} " @tap="tapInfo(item.id)" v-for="(item,index) in fileListes"
|
<view class="form-view" :class=" {'cur': rSelect.indexOf(item.id)!=-1} " @tap="tapInfo(item.id)" v-for="(item,index) in fileListes"
|
||||||
:key="index">{{item.name}}</view>
|
:key="index">
|
||||||
|
{{item.name}}
|
||||||
|
<u-icon v-show="is_edit && item.user_id != 0" class="close" name="close" color="#666" size="18" @click="isTable(item.id,index)"></u-icon>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 添加标签的按钮 -->
|
<!-- 添加标签的按钮 -->
|
||||||
<u-popup v-model="show" mode="center" border-radius="14" :closeable="true">
|
<u-popup v-model="show" mode="center" border-radius="14" :closeable="true">
|
||||||
@@ -35,7 +41,8 @@
|
|||||||
action: 'http://www.example.com/upload',
|
action: 'http://www.example.com/upload',
|
||||||
fileList: [],
|
fileList: [],
|
||||||
show: false,
|
show: false,
|
||||||
rSelect: []
|
rSelect: [],
|
||||||
|
is_edit: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props:['fileListes'],
|
props:['fileListes'],
|
||||||
@@ -44,6 +51,10 @@
|
|||||||
console.log(this.show)
|
console.log(this.show)
|
||||||
this.show = !this.show
|
this.show = !this.show
|
||||||
},
|
},
|
||||||
|
// 编辑标签
|
||||||
|
editing() {
|
||||||
|
this.is_edit = !this.is_edit;
|
||||||
|
},
|
||||||
// 颜色切换
|
// 颜色切换
|
||||||
tapInfo(e) {
|
tapInfo(e) {
|
||||||
if (this.rSelect.indexOf(e) == -1) {
|
if (this.rSelect.indexOf(e) == -1) {
|
||||||
@@ -54,6 +65,31 @@
|
|||||||
}
|
}
|
||||||
this.$emit("qiehuan",this.rSelect)
|
this.$emit("qiehuan",this.rSelect)
|
||||||
},
|
},
|
||||||
|
// 删除标签
|
||||||
|
isTable(id,index) {
|
||||||
|
uni.showModal({
|
||||||
|
title: "提示",
|
||||||
|
content: "是否删除此标签?",
|
||||||
|
success: (res) => {
|
||||||
|
console.log();
|
||||||
|
if (res.confirm) {
|
||||||
|
this.delTable(id,index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
delTable(id,index) {
|
||||||
|
let me = this;
|
||||||
|
this.$u.post("Streaming/deltLabel", {label_id: id}).then(res => {
|
||||||
|
if (res.errCode == 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
this.fileListes.splice(index,1);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
chuangjian(){
|
chuangjian(){
|
||||||
this.$u.api.createLivesp({spec_name:this.form.name}).then((res)=>{
|
this.$u.api.createLivesp({spec_name:this.form.name}).then((res)=>{
|
||||||
if(res.errCode != 0){
|
if(res.errCode != 0){
|
||||||
@@ -62,7 +98,8 @@
|
|||||||
type: 'error'
|
type: 'error'
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
this.show_add()
|
this.show_add();
|
||||||
|
this.fileListes.push(res.data);
|
||||||
this.$refs.uToast.show({
|
this.$refs.uToast.show({
|
||||||
title: res.message,
|
title: res.message,
|
||||||
type: 'success'
|
type: 'success'
|
||||||
@@ -81,6 +118,11 @@
|
|||||||
width: 690rpx;
|
width: 690rpx;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
|
||||||
|
.flex-title {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
.form-view {
|
.form-view {
|
||||||
background: rgba(255, 255, 255, 1);
|
background: rgba(255, 255, 255, 1);
|
||||||
border-radius: 6rpx;
|
border-radius: 6rpx;
|
||||||
@@ -90,6 +132,10 @@
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-bottom: 28rpx;
|
margin-bottom: 28rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
|
.close {
|
||||||
|
margin-left: 10rpx;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.titles {
|
.titles {
|
||||||
|
|||||||
5
main.js
@@ -1,11 +1,12 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import App from './App'
|
import App from './App'
|
||||||
|
import IMService from './static/imservice.js'
|
||||||
import uView from "uview-ui";
|
import uView from "uview-ui";
|
||||||
Vue.use(uView);
|
Vue.use(uView);
|
||||||
|
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
|
Vue.prototype.imService = new IMService();
|
||||||
|
Vue.prototype.a = 1;
|
||||||
App.mpType = 'app'
|
App.mpType = 'app'
|
||||||
|
|
||||||
const app = new Vue({
|
const app = new Vue({
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "hdemingshangjia",
|
"name" : "德铭阳光商家",
|
||||||
"appid" : "",
|
"appid" : "__UNI__EA895BE",
|
||||||
"description" : "",
|
"description" : "",
|
||||||
"versionName" : "1.0.0",
|
"versionName" : "1.0.0",
|
||||||
"versionCode" : "100",
|
"versionCode" : "100",
|
||||||
@@ -16,8 +16,20 @@
|
|||||||
"autoclose" : true,
|
"autoclose" : true,
|
||||||
"delay" : 0
|
"delay" : 0
|
||||||
},
|
},
|
||||||
|
"safearea" : {
|
||||||
|
//安全区域配置,仅iOS平台生效
|
||||||
|
"bottom" : {
|
||||||
|
// 底部安全区域配置
|
||||||
|
"offset" : "none" // 底部安全区域偏移,"none"表示不空出安全区域,"auto"自动计算空出安全区域,默认值为"none"
|
||||||
|
}
|
||||||
|
},
|
||||||
/* 模块配置 */
|
/* 模块配置 */
|
||||||
"modules" : {},
|
"modules" : {
|
||||||
|
"Push" : {},
|
||||||
|
"OAuth" : {},
|
||||||
|
"VideoPlayer" : {},
|
||||||
|
"LivePusher" : {}
|
||||||
|
},
|
||||||
/* 应用发布信息 */
|
/* 应用发布信息 */
|
||||||
"distribute" : {
|
"distribute" : {
|
||||||
/* android打包配置 */
|
/* android打包配置 */
|
||||||
@@ -45,12 +57,68 @@
|
|||||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
|
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||||
]
|
],
|
||||||
|
"abiFilters" : [ "armeabi-v7a", "x86" ]
|
||||||
},
|
},
|
||||||
/* ios打包配置 */
|
/* ios打包配置 */
|
||||||
"ios" : {},
|
"ios" : {
|
||||||
|
"privacyDescription" : {
|
||||||
|
"NSPhotoLibraryUsageDescription" : "应用将在您上传图文视频等服务中使用您的相册。",
|
||||||
|
"NSMicrophoneUsageDescription" : "应用将会在您开启直播时使用您的麦克风。",
|
||||||
|
"NSCameraUsageDescription" : "应用将会在您开启直播时使用您的摄像头。"
|
||||||
|
}
|
||||||
|
},
|
||||||
/* SDK配置 */
|
/* SDK配置 */
|
||||||
"sdkConfigs" : {}
|
"sdkConfigs" : {
|
||||||
|
"ad" : {},
|
||||||
|
"push" : {},
|
||||||
|
"oauth" : {},
|
||||||
|
"maps" : {}
|
||||||
|
},
|
||||||
|
"icons" : {
|
||||||
|
"android" : {
|
||||||
|
"hdpi" : "unpackage/res/icons/72x72.png",
|
||||||
|
"xhdpi" : "unpackage/res/icons/96x96.png",
|
||||||
|
"xxhdpi" : "unpackage/res/icons/144x144.png",
|
||||||
|
"xxxhdpi" : "unpackage/res/icons/192x192.png"
|
||||||
|
},
|
||||||
|
"ios" : {
|
||||||
|
"appstore" : "unpackage/res/icons/1024x1024.png",
|
||||||
|
"ipad" : {
|
||||||
|
"app" : "unpackage/res/icons/76x76.png",
|
||||||
|
"app@2x" : "unpackage/res/icons/152x152.png",
|
||||||
|
"notification" : "unpackage/res/icons/20x20.png",
|
||||||
|
"notification@2x" : "unpackage/res/icons/40x40.png",
|
||||||
|
"proapp@2x" : "unpackage/res/icons/167x167.png",
|
||||||
|
"settings" : "unpackage/res/icons/29x29.png",
|
||||||
|
"settings@2x" : "unpackage/res/icons/58x58.png",
|
||||||
|
"spotlight" : "unpackage/res/icons/40x40.png",
|
||||||
|
"spotlight@2x" : "unpackage/res/icons/80x80.png"
|
||||||
|
},
|
||||||
|
"iphone" : {
|
||||||
|
"app@2x" : "unpackage/res/icons/120x120.png",
|
||||||
|
"app@3x" : "unpackage/res/icons/180x180.png",
|
||||||
|
"notification@2x" : "unpackage/res/icons/40x40.png",
|
||||||
|
"notification@3x" : "unpackage/res/icons/60x60.png",
|
||||||
|
"settings@2x" : "unpackage/res/icons/58x58.png",
|
||||||
|
"settings@3x" : "unpackage/res/icons/87x87.png",
|
||||||
|
"spotlight@2x" : "unpackage/res/icons/80x80.png",
|
||||||
|
"spotlight@3x" : "unpackage/res/icons/120x120.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"splashscreen" : {
|
||||||
|
"iosStyle" : "storyboard",
|
||||||
|
"ios" : {
|
||||||
|
"storyboard" : "/Users/xf/workspace/wwwroot/deming-uniapp/static/CustomStoryboard.zip"
|
||||||
|
},
|
||||||
|
"androidStyle" : "default",
|
||||||
|
"android" : {
|
||||||
|
"hdpi" : "/Users/xf/workspace/wwwroot/deming-uniapp/static/app/start/480x762.png",
|
||||||
|
"xhdpi" : "/Users/xf/workspace/wwwroot/deming-uniapp/static/app/start/720x1242.png",
|
||||||
|
"xxhdpi" : "/Users/xf/workspace/wwwroot/deming-uniapp/static/app/start/1080x1882.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/* 快应用特有相关 */
|
/* 快应用特有相关 */
|
||||||
|
|||||||
5
package-lock.json
generated
@@ -6,13 +6,8 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"uview-ui": {
|
"uview-ui": {
|
||||||
"version": "1.5.2",
|
"version": "1.5.2",
|
||||||
<<<<<<< HEAD
|
|
||||||
"resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-1.5.2.tgz",
|
"resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-1.5.2.tgz",
|
||||||
"integrity": "sha512-FV9G+gZTAZKEE2m85ahIbIRiC/fdzTl+eNXDIMBoyc9b+fQWQhEtmAfu6huu7AtKuTI6gfqaYn6WGcmqYvr76w=="
|
"integrity": "sha512-FV9G+gZTAZKEE2m85ahIbIRiC/fdzTl+eNXDIMBoyc9b+fQWQhEtmAfu6huu7AtKuTI6gfqaYn6WGcmqYvr76w=="
|
||||||
=======
|
|
||||||
"resolved": "https://registry.npm.taobao.org/uview-ui/download/uview-ui-1.5.2.tgz?cache=0&sync_timestamp=1594781920423&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fuview-ui%2Fdownload%2Fuview-ui-1.5.2.tgz",
|
|
||||||
"integrity": "sha1-4jDud0TIBjMJe74GU+IyvJSyAwk="
|
|
||||||
>>>>>>> fa383397b331ec0091096becf886f978cc1277fc
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
108
pages.json
@@ -2,8 +2,7 @@
|
|||||||
"easycom": {
|
"easycom": {
|
||||||
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
|
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
|
||||||
},
|
},
|
||||||
"pages": [
|
"pages": [{
|
||||||
{
|
|
||||||
"path": "pages/login/login",
|
"path": "pages/login/login",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "",
|
"navigationBarTitleText": "",
|
||||||
@@ -14,6 +13,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/login/agreements",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "用户协议与隐私政策",
|
||||||
|
"app-plus": {
|
||||||
|
"titleNView": {
|
||||||
|
"backgroundColor": "#FFFFFF",
|
||||||
|
"titleColor": "#333333"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/release/tosign",
|
"path": "pages/release/tosign",
|
||||||
"style": {
|
"style": {
|
||||||
@@ -38,6 +49,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/messages/privateChat",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "uni-app",
|
||||||
|
"app-plus": {
|
||||||
|
"titleNView": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/index/index",
|
"path": "pages/index/index",
|
||||||
"style": {
|
"style": {
|
||||||
@@ -61,6 +81,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/index/otherdetails",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "试穿订单详情",
|
||||||
|
"app-plus": {
|
||||||
|
"titleNView": {
|
||||||
|
"titleColor": "#333333"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/release/video",
|
"path": "pages/release/video",
|
||||||
"style": {
|
"style": {
|
||||||
@@ -91,6 +122,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
"path": "pages/user/index",
|
"path": "pages/user/index",
|
||||||
|
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "个人中心",
|
"navigationBarTitleText": "个人中心",
|
||||||
"app-plus": {
|
"app-plus": {
|
||||||
@@ -101,6 +133,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/user/myinfo",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "达人中心",
|
||||||
|
"app-plus": {
|
||||||
|
"titleNView": {
|
||||||
|
"backgroundColor": "#FFFFFF",
|
||||||
|
"titleColor": "#333333"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/release/tosign",
|
"path": "pages/release/tosign",
|
||||||
"style": {
|
"style": {
|
||||||
@@ -120,7 +164,13 @@
|
|||||||
"app-plus": {
|
"app-plus": {
|
||||||
"titleNView": {
|
"titleNView": {
|
||||||
"backgroundColor": "#FFFFFF",
|
"backgroundColor": "#FFFFFF",
|
||||||
"titleColor": "#333333"
|
"titleColor": "#333333",
|
||||||
|
"buttons": [ //原生标题栏按钮配置,
|
||||||
|
{
|
||||||
|
"text": "保存",
|
||||||
|
"fontSize":"14px"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -184,6 +234,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/user/feedback",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "用户反馈",
|
||||||
|
"app-plus": {
|
||||||
|
"titleNView": {
|
||||||
|
"backgroundColor": "#FFFFFF",
|
||||||
|
"titleColor": "#333333"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/user/complaintDetails",
|
"path": "pages/user/complaintDetails",
|
||||||
"style": {
|
"style": {
|
||||||
@@ -218,6 +280,28 @@
|
|||||||
"animationType": "slide-in-bottom"
|
"animationType": "slide-in-bottom"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/messages/list",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "活动列表",
|
||||||
|
"app-plus": {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/messages/info",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "活动详情",
|
||||||
|
"app-plus": {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
,{
|
||||||
|
"path" : "pages/index/mention",
|
||||||
|
"style" : {
|
||||||
|
"navigationBarTitleText": "上传凭证"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
@@ -228,26 +312,30 @@
|
|||||||
},
|
},
|
||||||
"tabBar": {
|
"tabBar": {
|
||||||
"color": "#7A7E83",
|
"color": "#7A7E83",
|
||||||
"selectedColor": "#3cc51f",
|
"selectedColor": "#FF780F",
|
||||||
"borderStyle": "black",
|
"borderStyle": "black",
|
||||||
"backgroundColor": "#ffffff",
|
"backgroundColor": "#ffffff",
|
||||||
"height": "50px",
|
"height": "50px",
|
||||||
"fontSize": "10px",
|
|
||||||
"iconWidth": "24px",
|
"iconWidth": "24px",
|
||||||
"spacing": "3px",
|
"spacing": "3px",
|
||||||
"list": [{
|
"list": [{
|
||||||
"pagePath": "pages/index/index",
|
"pagePath": "pages/index/index",
|
||||||
"iconPath": "",
|
"iconPath": "static/image/tabbar/index.png",
|
||||||
"selectedIconPath": "",
|
"selectedIconPath": "static/image/tabbar/indexselect.png",
|
||||||
"text": "首页",
|
"text": "首页",
|
||||||
"selectedColor": "#FBFBFB"
|
"selectedColor": "#FBFBFB"
|
||||||
|
}, {
|
||||||
|
"pagePath": "pages/messages/messagesList",
|
||||||
|
"iconPath": "static/image/tabbar/info.png",
|
||||||
|
"selectedIconPath": "static/image/tabbar/infoselect.png",
|
||||||
|
"text": "消息",
|
||||||
|
"selectedColor": "#FBFBFB"
|
||||||
}, {
|
}, {
|
||||||
"pagePath": "pages/user/index",
|
"pagePath": "pages/user/index",
|
||||||
"iconPath": "",
|
"iconPath": "static/image/tabbar/mine.png",
|
||||||
"selectedIconPath": "",
|
"selectedIconPath": "static/image/tabbar/mineselect.png",
|
||||||
"text": "我的",
|
"text": "我的",
|
||||||
"selectedColor": "#FBFBFB"
|
"selectedColor": "#FBFBFB"
|
||||||
}]
|
}]
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,41 +1,35 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="home">
|
<view class="home">
|
||||||
<view class="image-swiper">
|
<view class="image-swiper"><u-swiper :list="imageList" mode="dot" border-radius="20"></u-swiper></view>
|
||||||
<u-swiper :list="imageList" mode="dot" border-radius="20"></u-swiper>
|
|
||||||
</view>
|
|
||||||
<view class="tab-swiper">
|
<view class="tab-swiper">
|
||||||
<u-tabs-swiper ref="uTabs" :list="list" :current="current" @change="tabsChange" active-color="#FF780F" inactive-color="#333333" font-size="26" height="98" :show-bar="false" swiperWidth="750" gutter="52"></u-tabs-swiper>
|
<u-tabs :list="list" font-size="26" gutter="10" item-width="130" bar-width="120" active-color="#FF780F" :current="current" @change="tabsChange"></u-tabs>
|
||||||
</view>
|
</view>
|
||||||
<swiper :current="swiperCurrent" @animationfinish="animationfinish">
|
|
||||||
<swiper-item class="swiper-item">
|
<view class="order-list" v-if="current == 0">
|
||||||
<scroll-view scroll-y style="height: 100%;width: 100%;" class="order-list">
|
<view v-for="(item, index) in allorder" :key="index"><OrderItem :info="item"></OrderItem></view>
|
||||||
<view v-for="(item, index) in 5" :key="index">
|
<u-empty margin-top="20" v-if="!allorder.length" mode="order"></u-empty>
|
||||||
<OrderItem :cur="current"></OrderItem>
|
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
<view v-else-if="current == 1">
|
||||||
</swiper-item>
|
<view v-for="(item, index) in testlist" :key="index"><testList :info="item"></testList></view>
|
||||||
<swiper-item class="swiper-item">
|
<u-empty margin-top="20" v-if="!testlist.length" mode="order"></u-empty>
|
||||||
<scroll-view scroll-y style="height: 100%;width: 100%;">
|
|
||||||
<view v-for="(item, index) in 5" :key="index">
|
|
||||||
<OrderItem :cur="current"></OrderItem>
|
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
<view v-else-if="current == 2">
|
||||||
</swiper-item>
|
<view v-for="(item, index) in worklist" :key="index"><OrderItem :info="item"></OrderItem></view>
|
||||||
<swiper-item class="swiper-item">
|
<u-empty margin-top="20" v-if="!worklist.length" mode="order"></u-empty>
|
||||||
<scroll-view scroll-y style="height: 100%;width: 100%;">
|
|
||||||
<view v-for="(item, index) in 5" :key="index">
|
|
||||||
<OrderItem :cur="current"></OrderItem>
|
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
<view v-else-if="current == 3">
|
||||||
</swiper-item>
|
<view v-for="(item, index) in translist" :key="index"><OrderItem :info="item"></OrderItem></view>
|
||||||
<swiper-item class="swiper-item">
|
<u-empty margin-top="20" v-if="!translist.length" mode="order"></u-empty>
|
||||||
<scroll-view scroll-y style="height: 100%;width: 100%;">
|
</view>
|
||||||
|
<view v-else-if="current == 4">
|
||||||
<view class="complaint">
|
<view class="complaint">
|
||||||
<view class="select-container">
|
<view class="select-container">
|
||||||
<view class="title">选择骑手</view>
|
<view class="title">选择订单号</view>
|
||||||
<view class="worker" v-if="JSON.stringify(worker) != '{}'">
|
<view class="worker" v-if="JSON.stringify(worker) != '{}'">
|
||||||
<view>{{ worker.company + " " + worker.name }}</view>
|
<view>{{ worker.name }}</view>
|
||||||
<u-icon name="edit-pen" @click="worker={}"></u-icon>
|
<u-icon name="arrow-down" @click="worker = {}"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
<view v-else class="select" @click="showSelect = true">
|
<view v-else class="select" @click="showSelect = true">
|
||||||
<view>请选择</view>
|
<view>请选择</view>
|
||||||
@@ -44,33 +38,35 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="textarea">
|
<view class="textarea">
|
||||||
<view class="title">投诉简介</view>
|
<view class="title">投诉简介</view>
|
||||||
<textarea placeholder-style="color:#999999" placeholder="请输入内容" />
|
<textarea placeholder-style="color:#999999" placeholder="请输入内容" v-model="reportcontent" />
|
||||||
</view>
|
</view>
|
||||||
<!-- 事件 -->
|
<!-- 事件 -->
|
||||||
<view class="btn" @click="showComplaint=true">确定</view>
|
<view class="btn" @click="reportcar">确定</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
|
||||||
</swiper-item>
|
|
||||||
<swiper-item class="swiper-item">
|
|
||||||
<scroll-view scroll-y style="height: 100%;width: 100%;">
|
|
||||||
<view v-for="(item, index) in 5" :key="index">
|
|
||||||
<OrderItem :cur="current"></OrderItem>
|
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
<view v-else-if="current == 5">
|
||||||
</swiper-item>
|
<view v-for="(item, index) in finshlist" :key="index">
|
||||||
<swiper-item class="swiper-item">
|
<OrderItem :info="item"></OrderItem>
|
||||||
<scroll-view scroll-y style="height: 100%;width: 100%;">
|
</view>
|
||||||
<view v-for="(item, index) in 15" :key="index">
|
<u-empty margin-top="20" v-if="!finshlist.length" mode="order"></u-empty>
|
||||||
<OrderItem :cur="current"></OrderItem>
|
</view>
|
||||||
|
<view v-else-if="current == 6">
|
||||||
|
<view v-for="(item, index) in badlist" :key="index">
|
||||||
|
<OrderItem :info="item"></OrderItem>
|
||||||
|
</view>
|
||||||
|
<u-empty margin-top="20" v-if="!badlist.length" mode="order"></u-empty>
|
||||||
|
</view>
|
||||||
|
<view v-else-if="current == 7">
|
||||||
|
<view v-for="(item, index) in paidList" :key="index">
|
||||||
|
<OrderItem :info="item"></OrderItem>
|
||||||
|
</view>
|
||||||
|
<u-empty margin-top="20" v-if="!paidList.length" mode="order"></u-empty>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
|
||||||
</swiper-item>
|
|
||||||
</swiper>
|
|
||||||
<view class="release-btn" @click="publish">
|
<view class="release-btn" @click="publish">
|
||||||
<image src="/static/home/1.png"></image>
|
<image src="../../static/image/index/publish.png"></image>
|
||||||
<view class="text" @click="release()">发布</view>
|
<view class="text">发布</view>
|
||||||
</view>
|
</view>
|
||||||
<u-select v-model="showSelect" mode="mutil-column-auto" :list="workerList" @confirm="setWorker"></u-select>
|
<u-select v-model="showSelect" :list="carlist" @confirm="setWorker" confirm-color="#FF780F"></u-select>
|
||||||
<u-popup v-model="showComplaint" mode="center" border-radius="10">
|
<u-popup v-model="showComplaint" mode="center" border-radius="10">
|
||||||
<view class="confirm-complaint">
|
<view class="confirm-complaint">
|
||||||
<view class="text">
|
<view class="text">
|
||||||
@@ -84,133 +80,343 @@
|
|||||||
<view class="publish">
|
<view class="publish">
|
||||||
<view class="list">
|
<view class="list">
|
||||||
<view @click="navto('release/tosign')">
|
<view @click="navto('release/tosign')">
|
||||||
<image></image>
|
<image src="../../static/image/index/live.png"></image>
|
||||||
<text>直播</text>
|
<text>直播</text>
|
||||||
</view>
|
</view>
|
||||||
<view @click="navto('release/index')">
|
<view @click="navto('release/index')">
|
||||||
<image></image>
|
<image src="../../static/image/index/photo.png"></image>
|
||||||
<text>图文</text>
|
<text>图文</text>
|
||||||
</view>
|
</view>
|
||||||
<view @click="navto('release/video')">
|
<view @click="navto('release/video')">
|
||||||
<image></image>
|
<image src="../../static/image/index/video.png"></image>
|
||||||
<text>视频</text>
|
<text>视频</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<image class="off"></image>
|
<image src="../../static/image/index/close.png" class="off" @click="close"></image>
|
||||||
</view>
|
</view>
|
||||||
</u-popup>
|
</u-popup>
|
||||||
|
<u-toast ref="uToast" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import OrderItem from '@/components/order-item/index'
|
import OrderItem from '@/components/order-item/index';
|
||||||
|
import testList from '@/components/order-item/testlist.vue';
|
||||||
export default {
|
export default {
|
||||||
|
components: {
|
||||||
|
OrderItem,
|
||||||
|
testList
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
list: [{
|
list: [
|
||||||
|
{
|
||||||
name: '全部订单'
|
name: '全部订单'
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
name: '试穿订单'
|
name: '试穿订单'
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
name: '待处理订单'
|
name: '待处理订单'
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
|
name: '已发货订单'
|
||||||
|
},
|
||||||
|
{
|
||||||
name: '投诉骑手'
|
name: '投诉骑手'
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
name: '已完成订单'
|
name: '已完成订单'
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
name: '退货订单'
|
name: '退货订单'
|
||||||
}],
|
},
|
||||||
imageList: [
|
{
|
||||||
{}, {}, {}
|
name: '待支付订单'
|
||||||
|
}
|
||||||
],
|
],
|
||||||
|
imageList: [],
|
||||||
showSelect: false,
|
showSelect: false,
|
||||||
current: 0,
|
current: 0,
|
||||||
swiperCurrent: 0,
|
swiperCurrent: 0,
|
||||||
showComplaint: false,
|
showComplaint: false,
|
||||||
worker: {},
|
worker: {},
|
||||||
workerList: [
|
publishstate: false,
|
||||||
{
|
clickstate:false,//投诉骑手按钮点击状态
|
||||||
label: '百世快递公司',
|
num: 1,
|
||||||
children: [
|
allorder: [], //所有订单
|
||||||
{
|
testlist: [], //试穿列表
|
||||||
label: '小米'
|
worklist: [], //待处理列表
|
||||||
},
|
translist: [], //已发货列表
|
||||||
{
|
finshlist: [], //已完成列表
|
||||||
label: '小亮'
|
badlist: [], //退货列表
|
||||||
}
|
carlist: [], //可投诉订单列表
|
||||||
]
|
paidList: [], // 待支付订单
|
||||||
},
|
reportinfo: null, //投诉信息
|
||||||
{
|
reportcontent: '', //投诉内容
|
||||||
label: '中通快递公司',
|
del_id: 0, // 删除id
|
||||||
children: [
|
};
|
||||||
{
|
|
||||||
label: '小红'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '申通快递公司',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
label: '小蓝'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
publishstate:true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
OrderItem
|
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
|
// 初始化轮播图
|
||||||
|
this.getswiper();
|
||||||
|
// 获取可投诉列表
|
||||||
|
this.getcarlist();
|
||||||
|
// 所有订单
|
||||||
|
this.getallorder(0);
|
||||||
|
const user = uni.getStorageSync('userinfo');
|
||||||
|
console.log(user)
|
||||||
|
this.imService.login(user.member_id,user.member_nickname,user.member_avatar)
|
||||||
|
this.imService.connectIM()
|
||||||
|
// 订单状态: 0:全部 1已付款未发货 2已发货 3已完成 4申请退款/退货 5已退款/退货 6拒绝退款/退货
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.publishstate = false;
|
||||||
|
this.tabsChange(this.current);
|
||||||
|
},
|
||||||
|
onReachBottom() {
|
||||||
|
this.num++;
|
||||||
|
this.reset();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
release(){
|
// 初始化数组
|
||||||
this.publishstate = true
|
resetarr() {
|
||||||
|
this.allorder = [];
|
||||||
|
this.worklist = [];
|
||||||
|
this.translist = [];
|
||||||
|
this.finshlist = [];
|
||||||
|
this.badlist = [];
|
||||||
|
this.badlist = [];
|
||||||
|
this.testlist = [];
|
||||||
|
this.paidList = [];
|
||||||
},
|
},
|
||||||
publish(){
|
// 根据current请求不同的接口
|
||||||
|
reset() {
|
||||||
},
|
let current = this.current;
|
||||||
setWorker(e) {
|
if (current == 0) {
|
||||||
// console.log(e);
|
// 所有订单
|
||||||
this.worker = {
|
this.getallorder(0);
|
||||||
company: e[0].label,
|
} else if (current == 1) {
|
||||||
name: e[1].label
|
// 试穿订单
|
||||||
|
this.getshiftlist();
|
||||||
|
} else if (current == 2) {
|
||||||
|
// 待处理订单
|
||||||
|
this.getallorder(1);
|
||||||
|
} else if (current == 3) {
|
||||||
|
// 已发货订单
|
||||||
|
this.getallorder(2);
|
||||||
|
} else if (current == 4) {
|
||||||
|
// 投诉
|
||||||
|
} else if (current == 5) {
|
||||||
|
// 已完成订单
|
||||||
|
this.getallorder(3);
|
||||||
|
} else if (current == 6) {
|
||||||
|
// 退货订单
|
||||||
|
this.getallorder(4);
|
||||||
|
} else if (current == 7) {
|
||||||
|
// 待支付订单
|
||||||
|
this.getallorder(10);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 关闭发布弹窗
|
||||||
|
close() {
|
||||||
|
this.publishstate = false;
|
||||||
|
},
|
||||||
|
// 投诉骑手
|
||||||
|
reportcar(type) {
|
||||||
|
let that = this;
|
||||||
|
if(this.clickstate==false){
|
||||||
|
this.clickstate=true
|
||||||
|
}else{
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: "不能重复提交",
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (that.reportcontent == '') {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: "投诉内容不能为空",
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$u.api.reportorder({
|
||||||
|
order_id: that.reportinfo.order_id,
|
||||||
|
takeawayer_id: that.reportinfo.takeawayer_id,
|
||||||
|
order_list: that.reportinfo.order_list,
|
||||||
|
content: that.reportcontent
|
||||||
|
}).then(res => {
|
||||||
|
// 恢复可点击状态
|
||||||
|
this.clickstate=false
|
||||||
|
if (res.errCode != 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// 提交后清空选择信息
|
||||||
|
that.reportinfo=null
|
||||||
|
// 清空投诉评价
|
||||||
|
that.reportcontent = ""
|
||||||
|
// 清空选择器返回信息
|
||||||
|
that.worker = {}
|
||||||
|
// 重新获取可投诉列表
|
||||||
|
that.getcarlist();
|
||||||
|
// 提示修改成功
|
||||||
|
that.showComplaint = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 获取可投诉列表
|
||||||
|
getcarlist() {
|
||||||
|
let that = this;
|
||||||
|
this.$u.api.canreportorder({}).then(res => {
|
||||||
|
console.log(res);
|
||||||
|
if (res.errCode != 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
let arr = res.data.order_normal;
|
||||||
|
// {
|
||||||
|
// value: 2,
|
||||||
|
// label: '广东',
|
||||||
|
// children: [
|
||||||
|
// {
|
||||||
|
// value: 3,
|
||||||
|
// label: '深圳'
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// value: 4,
|
||||||
|
// label: '广州'
|
||||||
|
// }
|
||||||
|
// ]
|
||||||
|
// },
|
||||||
|
for (let index in arr) {
|
||||||
|
arr[index].value = arr[index].takeawayer_id;
|
||||||
|
let newarr = arr[index].order_list.split('-');
|
||||||
|
arr[index].label = newarr[0] + ' ' + newarr[1];
|
||||||
|
}
|
||||||
|
this.carlist = arr;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 获取试穿列表
|
||||||
|
getshiftlist() {
|
||||||
|
let that = this;
|
||||||
|
this.$u.api.getshiftlist({}).then(res => {
|
||||||
|
// console.log(JSON.stringify(res));
|
||||||
|
if (res.errCode != 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.testlist = res.data.orderList;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 获取订单列表
|
||||||
|
getallorder(type) {
|
||||||
|
let that = this;
|
||||||
|
this.$u.api.getorderlist({
|
||||||
|
type: type,
|
||||||
|
page: that.num
|
||||||
|
}).then(res => {
|
||||||
|
if (res.errCode != 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
let arr = res.data;
|
||||||
|
for (let index in arr) {
|
||||||
|
if (type == 0) {
|
||||||
|
this.allorder.push(arr[index]);
|
||||||
|
} else if (type == 1) {
|
||||||
|
this.worklist.push(arr[index]);
|
||||||
|
} else if (type == 2) {
|
||||||
|
this.translist.push(arr[index]);
|
||||||
|
} else if (type == 3) {
|
||||||
|
this.finshlist.push(arr[index]);
|
||||||
|
} else if (type == 4) {
|
||||||
|
this.badlist.push(arr[index]);
|
||||||
|
} else if (type == 5) {
|
||||||
|
this.badlist.push(arr[index]);
|
||||||
|
} else if (type == 10) {
|
||||||
|
this.paidList.push(arr[index]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 获取轮播图
|
||||||
|
getswiper() {
|
||||||
|
this.$u.post("adv/indexAdv").then(res => {
|
||||||
|
let item = res.data;
|
||||||
|
let arr;
|
||||||
|
arr = item.map(data => {
|
||||||
|
console.log(data);
|
||||||
|
return {
|
||||||
|
image: data.adv_code,
|
||||||
|
adv_id: data.adv_id,
|
||||||
|
adv_link: data.adv_link,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.imageList = arr;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 打开发布弹窗
|
||||||
|
publish() {
|
||||||
|
this.publishstate = true;
|
||||||
|
},
|
||||||
|
// 骑手投诉点击确定
|
||||||
|
setWorker(e) {
|
||||||
|
if(e[0].label==null){
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: "选择无效",
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let arr = this.carlist;
|
||||||
|
for (let index in arr) {
|
||||||
|
if (arr[index].takeawayer_id == e[0].value) {
|
||||||
|
this.reportinfo = arr[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.worker = {
|
||||||
|
name: e[0].label,
|
||||||
|
id: e[0].value
|
||||||
|
};
|
||||||
|
},
|
||||||
|
// 导航栏点击事件
|
||||||
tabsChange(index) {
|
tabsChange(index) {
|
||||||
this.swiperCurrent = index;
|
this.swiperCurrent = index;
|
||||||
|
this.current = index;
|
||||||
|
this.num = 1;
|
||||||
|
this.resetarr();
|
||||||
|
this.reset();
|
||||||
},
|
},
|
||||||
animationfinish(e) {
|
// 发布内容跳转页面
|
||||||
let current = e.detail.current;
|
|
||||||
// this.$refs.uTabs.setFinishCurrent(current);
|
|
||||||
this.swiperCurrent = current;
|
|
||||||
this.current = current;
|
|
||||||
},
|
|
||||||
navto(url) {
|
navto(url) {
|
||||||
|
this.publishstate = false;
|
||||||
this.$u.route({
|
this.$u.route({
|
||||||
url: `/pages/${url}`
|
url: `/pages/${url}`
|
||||||
})
|
});
|
||||||
// console.log(`/pages/${url}`)
|
|
||||||
// uni.navigateTo({
|
|
||||||
// url: `/pages/${url}`
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.home {
|
.home {
|
||||||
min-height: calc(100vh - var(--window-top));
|
min-height: calc(100vh - var(--window-top));
|
||||||
background-color: #ECECEC;
|
background-color: #ececec;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
// padding-bottom: 100rpx;
|
|
||||||
> uni-swiper {
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
.image-swiper {
|
.image-swiper {
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
padding: 0 30rpx 16rpx;
|
padding: 0 30rpx 16rpx;
|
||||||
@@ -218,19 +424,20 @@ export default {
|
|||||||
.tab-swiper {
|
.tab-swiper {
|
||||||
margin: 2rpx 0 20rpx 0;
|
margin: 2rpx 0 20rpx 0;
|
||||||
}
|
}
|
||||||
.swiper-item {
|
|
||||||
.complaint {
|
.complaint {
|
||||||
margin: 0 30rpx;
|
margin: 0 30rpx;
|
||||||
padding: 75rpx 30rpx;
|
padding: 100rpx 20rpx;
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
.select-container {
|
.select-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 60rpx;
|
margin-bottom: 100rpx;
|
||||||
.title {
|
.title {
|
||||||
font-size: 30rpx;
|
width: 150rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
color: rgba(51, 51, 51, 1);
|
color: rgba(51, 51, 51, 1);
|
||||||
margin-right: 20rpx;
|
margin-right: 20rpx;
|
||||||
|
text-align: right;
|
||||||
}
|
}
|
||||||
.select {
|
.select {
|
||||||
padding: 18rpx 20rpx;
|
padding: 18rpx 20rpx;
|
||||||
@@ -253,8 +460,9 @@ export default {
|
|||||||
.worker {
|
.worker {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
background-color: #ececec;
|
||||||
> view {
|
> view {
|
||||||
font-size: 30rpx;
|
font-size: 26rpx;
|
||||||
color: rgba(51, 51, 51, 1);
|
color: rgba(51, 51, 51, 1);
|
||||||
margin-right: 20rpx;
|
margin-right: 20rpx;
|
||||||
}
|
}
|
||||||
@@ -264,7 +472,9 @@ export default {
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
display: flex;
|
display: flex;
|
||||||
.title {
|
.title {
|
||||||
font-size: 30rpx;
|
width: 150rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
text-align: right;
|
||||||
color: rgba(51, 51, 51, 1);
|
color: rgba(51, 51, 51, 1);
|
||||||
margin-right: 20rpx;
|
margin-right: 20rpx;
|
||||||
}
|
}
|
||||||
@@ -288,7 +498,6 @@ export default {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
.release-btn {
|
.release-btn {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 475rpx;
|
bottom: 475rpx;
|
||||||
@@ -346,12 +555,11 @@ export default {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 50rpx 84rpx 31rpx 78rpx;
|
padding: 50rpx 84rpx 31rpx 78rpx;
|
||||||
image {
|
image {
|
||||||
background-color: #0f0;
|
|
||||||
}
|
}
|
||||||
.list {
|
.list {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-around;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
> view {
|
> view {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
147
pages/index/mention.vue
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<view class="upload">
|
||||||
|
<view class="title">
|
||||||
|
<text>上传凭证</text>
|
||||||
|
<text class="tips">(仅可上传1张凭证)</text>
|
||||||
|
</view>
|
||||||
|
<u-upload class="upload-box" :form-data="coverformdata" upload-text="" :action="action" :header="header" name="common" :max-count="1" @on-success="uploadSuc"></u-upload>
|
||||||
|
</view>
|
||||||
|
<view class="remarks">
|
||||||
|
<view>备注:</view>
|
||||||
|
<textarea class="textarea-box" v-model="textareaVal" placeholder="请输入内容..." placeholder-class="placeholder-style" />
|
||||||
|
</view>
|
||||||
|
<u-button class="btn-submit" @click="submitInfo">提交</u-button>
|
||||||
|
<u-toast ref="uToast" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
header: {
|
||||||
|
Authorization: 'Bearer' + ' ' + uni.getStorageSync('token')
|
||||||
|
},
|
||||||
|
action: "https://mall.dmygkeji.com/api/Upload/uploadfile",
|
||||||
|
coverformdata: {
|
||||||
|
name: 'common'
|
||||||
|
},
|
||||||
|
img_url: "", // 图片路径
|
||||||
|
textareaVal: "", // 备注
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onLoad(option) {
|
||||||
|
// console.log(option);
|
||||||
|
this.order_id = option.id;
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 上传成功
|
||||||
|
uploadSuc(e) {
|
||||||
|
if (e.errCode == 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: e.message,
|
||||||
|
type: "success"
|
||||||
|
})
|
||||||
|
// console.log(e.data);
|
||||||
|
this.img_url = e.data.file_path;
|
||||||
|
} else {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: e.message,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 自提提交
|
||||||
|
submitInfo() {
|
||||||
|
if (!this.img_url) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: "请上传凭证!",
|
||||||
|
type: "warning"
|
||||||
|
})
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!this.$u.trim(this.textareaVal)) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: "请填写备注!",
|
||||||
|
type: "warning"
|
||||||
|
})
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 提交
|
||||||
|
this.$u.api.bindmention({
|
||||||
|
store_deliver_type: 3,
|
||||||
|
shipping_express_id: "e1000",
|
||||||
|
deliver_explain: this.textareaVal,
|
||||||
|
order_id: this.order_id,
|
||||||
|
sendimg: this.img_url,
|
||||||
|
}).then(res => {
|
||||||
|
console.log(res);
|
||||||
|
if (res.errCode == 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: "success",
|
||||||
|
isTab: "true",
|
||||||
|
url: "/pages/index/index"
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: "warning"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.container {
|
||||||
|
padding: 30rpx;
|
||||||
|
}
|
||||||
|
::v-deep.uicon-plus {
|
||||||
|
font-size: 50rpx !important;
|
||||||
|
}
|
||||||
|
.upload {
|
||||||
|
.title {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #333;
|
||||||
|
.tips {
|
||||||
|
font-size: 20rpx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.upload-box {
|
||||||
|
margin: 20rpx 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.remarks {
|
||||||
|
.textarea-box {
|
||||||
|
width: calc(100% - 42rpx);
|
||||||
|
padding: 20rpx;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
border: 1px solid #BABABA;
|
||||||
|
}
|
||||||
|
.placeholder-style {
|
||||||
|
color: #999;
|
||||||
|
font-size: 26rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.btn-submit {
|
||||||
|
width: 690rpx;
|
||||||
|
height: 98rpx !important;
|
||||||
|
margin-top: 70rpx;
|
||||||
|
font-size: 36rpx !important;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 98rpx !important;
|
||||||
|
color: #fff !important;
|
||||||
|
border-radius: 50rpx;
|
||||||
|
background-color: #FF780F !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
473
pages/index/otherdetails.vue
Normal file
@@ -0,0 +1,473 @@
|
|||||||
|
<template>
|
||||||
|
<view class="details">
|
||||||
|
<view class="goods-info">
|
||||||
|
<image :src="info.goods_image"></image>
|
||||||
|
<view class="info-right">
|
||||||
|
<view class="name u-line-1">{{ info.goods_name }}</view>
|
||||||
|
<view class="info">
|
||||||
|
<view class="num">共{{ info.goods_try_num }}件商品</view>
|
||||||
|
<view class="price">
|
||||||
|
实付
|
||||||
|
<span>¥{{ info.goods_price }}</span>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 待处理订单/已发货订单,收货人信息 -->
|
||||||
|
<view class="user-info">
|
||||||
|
<view class="info-title">收件人信息</view>
|
||||||
|
<view class="info-container">
|
||||||
|
<view>
|
||||||
|
<view class="title">姓名</view>
|
||||||
|
<view class="value">{{ info.goods_try_member_name }}</view>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
<view class="title">手机号</view>
|
||||||
|
<view class="value">{{ info.goods_try_member_mobile }}</view>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
<view class="title">收货地址</view>
|
||||||
|
<view class="value u-line-1">{{ info.goods_try_area_info }}</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="type==2">
|
||||||
|
<view class="title">派送方式</view>
|
||||||
|
<view class="value u-line-1">{{ info.goods_try_deliver_goods_type==1?"人工送达":"骑手" }}</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 已拒绝/已完成订单,收货人信息 -->
|
||||||
|
<!-- <view class="refunds-user" v-if="type == 3 || type == 4">
|
||||||
|
<view>
|
||||||
|
<image src="/static/image/home/2.png"></image>
|
||||||
|
<view>{{ info.goods_try_member_name }}</view>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
<image src="/static/image/home/3.png"></image>
|
||||||
|
<view>{{ info.goods_try_member_mobile }}</view>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
<image src="/static/image/home/4.png"></image>
|
||||||
|
<view class="address u-line-1">{{ info.goods_try_area_info }}</view>
|
||||||
|
</view>
|
||||||
|
</view> -->
|
||||||
|
<!-- 待处理订单 -->
|
||||||
|
<view class="delivery" v-if="type == 1">
|
||||||
|
<view class="title">派送方式</view>
|
||||||
|
<view class="methods">
|
||||||
|
<view :class="{ active: cur == 0 }" @click="people">人工送达</view>
|
||||||
|
<view :class="{ active: cur == 1 }" @click="carer">指派外部骑手</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="btn" @click="confirmpushstyle">确认</view>
|
||||||
|
</view>
|
||||||
|
<!-- 已发货 -->
|
||||||
|
<!-- 人工送达 -->
|
||||||
|
<view class="refunds-user" v-if="info.goods_try_deliver_goods_type==1&&type==2">
|
||||||
|
<view>
|
||||||
|
<view>人工送达,请等待,货物正在飞速与你接近!</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 骑手 -->
|
||||||
|
<view class="refunds-title" v-if="type==2">配送信息</view>
|
||||||
|
<view class="refunds-title" v-if="type==3||type==4">提示信息</view>
|
||||||
|
<view class="refunds-user" v-if="info.goods_try_deliver_goods_type==2&&type==2">
|
||||||
|
<view>
|
||||||
|
<image src="/static/image/home/2.png"></image>
|
||||||
|
<view>{{ info.takeawayer_name }}</view>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
<image src="/static/image/home/3.png"></image>
|
||||||
|
<view>{{ info.takeawayer_mobile }}</view>
|
||||||
|
</view>
|
||||||
|
<!-- 骑手公司 -->
|
||||||
|
<!-- <view>
|
||||||
|
<image src="/static/image/home/4.png"></image>
|
||||||
|
<view class="address u-line-1">{{ info.goods_try_area_info }}</view>
|
||||||
|
</view> -->
|
||||||
|
</view>
|
||||||
|
<!-- 已经拒绝 -->
|
||||||
|
<view class="refunds-user" v-if="type==3">
|
||||||
|
<view>
|
||||||
|
<view>抱歉,商家正忙无法接单,期待下次为您服务!</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 已完成订单 -->
|
||||||
|
<view class="refunds-user" v-if="type==4">
|
||||||
|
<view>
|
||||||
|
<view>订单配送完成,期待下次为您服务!</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<u-picker mode="selector" v-model="show" :default-selector="[0]" :range="list" range-key="content" @confirm="getselect"></u-picker>
|
||||||
|
<u-toast ref="uToast" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
status: 1, // 订单状态
|
||||||
|
cur: Number,
|
||||||
|
showDelivery: false, // 填写骑手信息
|
||||||
|
showExpress: false, // 填写快递单号
|
||||||
|
showRefunds: false, // 平台退货处理
|
||||||
|
show: false, // 骑手列表
|
||||||
|
name: '',
|
||||||
|
phone: '',
|
||||||
|
company: '',
|
||||||
|
express: '',
|
||||||
|
type: '',
|
||||||
|
orderid: 0,
|
||||||
|
info: {},
|
||||||
|
list: [],
|
||||||
|
selctcar: null //选择骑手ID
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onLoad(option) {
|
||||||
|
this.type = option.type;
|
||||||
|
this.orderid = option.id;
|
||||||
|
this.resetinfo();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 人工配送
|
||||||
|
people() {
|
||||||
|
this.cur = 0;
|
||||||
|
},
|
||||||
|
carer() {
|
||||||
|
this.cur = 1;
|
||||||
|
this.show = true;
|
||||||
|
},
|
||||||
|
// 绑定配送方式
|
||||||
|
confirmpushstyle() {
|
||||||
|
if (this.cur == 0) {
|
||||||
|
this.$u.api.agreetest({
|
||||||
|
goods_try_id: this.orderid,
|
||||||
|
type: 1,
|
||||||
|
takeawayer_id: 0
|
||||||
|
}).then(res => {
|
||||||
|
console.log(res);
|
||||||
|
if (res.errCode != 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$u.api.agreetest({
|
||||||
|
goods_try_id: this.orderid,
|
||||||
|
type: 2,
|
||||||
|
takeawayer_id: this.selctcar.takeawayer_id
|
||||||
|
}).then(res => {
|
||||||
|
console.log(res);
|
||||||
|
if (res.errCode != 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 选择骑手
|
||||||
|
getselect(e) {
|
||||||
|
this.selctcar = this.list[e[0]];
|
||||||
|
},
|
||||||
|
// 获取订单信息
|
||||||
|
resetinfo() {
|
||||||
|
this.$u.api.testorderdetail({
|
||||||
|
goods_try_id: this.orderid
|
||||||
|
}).then(res => {
|
||||||
|
console.log(res);
|
||||||
|
if (res.errCode != 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.info = res.data.info;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 获取骑手列表
|
||||||
|
this.$u.api.takeawayerlist({}).then(res => {
|
||||||
|
console.log(res);
|
||||||
|
if (res.errCode != 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
let arr = res.data;
|
||||||
|
for (let index in arr) {
|
||||||
|
arr[index].content = arr[index].company_name + '——' + arr[index].contacts + '——' + arr[index].contact_number;
|
||||||
|
}
|
||||||
|
this.list = arr;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.details {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-height: calc(100vh - var(--window-top));
|
||||||
|
background-color: #ececec;
|
||||||
|
.goods-info {
|
||||||
|
background-color: #ffffff;
|
||||||
|
padding: 30rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin: 2rpx 0 20rpx;
|
||||||
|
> image {
|
||||||
|
width: 160rpx;
|
||||||
|
height: 160rpx;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
flex-shrink: 0;
|
||||||
|
margin-right: 26rpx;
|
||||||
|
}
|
||||||
|
.info-right {
|
||||||
|
.name {
|
||||||
|
width: 439rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: rgba(51, 51, 51, 1);
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
}
|
||||||
|
.info {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: rgba(102, 102, 102, 1);
|
||||||
|
.price {
|
||||||
|
margin-left: 10rpx;
|
||||||
|
> span {
|
||||||
|
color: #ff780f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.refunds-title{
|
||||||
|
padding: 25rpx 30rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #333333;
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-bottom: 2rpx solid #ececec;
|
||||||
|
}
|
||||||
|
.refunds-user {
|
||||||
|
padding: 25rpx 30rpx;
|
||||||
|
background-color: #ffffff;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
> view {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
@mixin image-class($width, $right) {
|
||||||
|
> image {
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: $width;
|
||||||
|
height: 40rpx;
|
||||||
|
margin-right: $right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&:first-child {
|
||||||
|
@include image-class($width: 40rpx, $right: 20rpx);
|
||||||
|
}
|
||||||
|
&:nth-child(2) {
|
||||||
|
margin-left: 4rpx;
|
||||||
|
@include image-class($width: 32rpx, $right: 24rpx);
|
||||||
|
}
|
||||||
|
&:last-child {
|
||||||
|
margin-left: 2rpx;
|
||||||
|
@include image-class($width: 36rpx, $right: 22rpx);
|
||||||
|
}
|
||||||
|
> view {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: rgba(51, 51, 51, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.user-info {
|
||||||
|
.info-title {
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
color: rgba(51, 51, 51, 1);
|
||||||
|
height: 88rpx;
|
||||||
|
background-color: #ffffff;
|
||||||
|
margin-bottom: 2rpx;
|
||||||
|
padding: 30rpx;
|
||||||
|
}
|
||||||
|
.info-container {
|
||||||
|
padding: 0 30rpx;
|
||||||
|
background-color: #ffffff;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
> view {
|
||||||
|
height: 88rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
color: rgba(51, 51, 51, 1);
|
||||||
|
&:not(:last-child) {
|
||||||
|
border-bottom: 2rpx solid #ececec;
|
||||||
|
}
|
||||||
|
.title {
|
||||||
|
width: 170rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
margin-right: 10rpx;
|
||||||
|
}
|
||||||
|
.value {
|
||||||
|
font-size: 26rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.delivery {
|
||||||
|
flex: 1;
|
||||||
|
background-color: #ffffff;
|
||||||
|
padding: 30rpx;
|
||||||
|
position: relative;
|
||||||
|
.title {
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
color: rgba(51, 51, 51, 1);
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
}
|
||||||
|
.methods {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
> view {
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: rgba(0, 0, 51, 1);
|
||||||
|
width: 335rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
border: 1rpx solid rgba(236, 236, 236, 1);
|
||||||
|
background: rgba(236, 236, 236, 1);
|
||||||
|
border-radius: 6rpx;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 80rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
&:nth-child(2n-1) {
|
||||||
|
margin-right: 20rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.active {
|
||||||
|
border: 1rpx solid #ff780f;
|
||||||
|
color: #ff780f;
|
||||||
|
background: #fff1e6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.btn {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 40rpx;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, 0);
|
||||||
|
width: 690rpx;
|
||||||
|
height: 98rpx;
|
||||||
|
background: rgba(255, 120, 15, 1);
|
||||||
|
border-radius: 49rpx;
|
||||||
|
font-size: 36rpx;
|
||||||
|
color: rgba(255, 255, 255, 1);
|
||||||
|
text-align: center;
|
||||||
|
line-height: 98rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.refunds-option {
|
||||||
|
flex: 1;
|
||||||
|
padding: 88rpx 30rpx;
|
||||||
|
background-color: #ffffff;
|
||||||
|
display: flex;
|
||||||
|
> view {
|
||||||
|
width: 335rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
border: 1rpx solid rgba(236, 236, 236, 1);
|
||||||
|
background: rgba(236, 236, 236, 1);
|
||||||
|
border-radius: 6rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: rgba(0, 0, 51, 1);
|
||||||
|
line-height: 80rpx;
|
||||||
|
text-align: center;
|
||||||
|
margin-right: 20rpx;
|
||||||
|
}
|
||||||
|
.active {
|
||||||
|
border: 1rpx solid #ff780f;
|
||||||
|
color: #ff780f;
|
||||||
|
background: #fff1e6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.delivery-popup {
|
||||||
|
.title {
|
||||||
|
width: 420rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
color: rgba(51, 51, 51, 1);
|
||||||
|
text-align: center;
|
||||||
|
line-height: 88rpx;
|
||||||
|
border-bottom: 2rpx solid #ececec;
|
||||||
|
}
|
||||||
|
.input-info {
|
||||||
|
> input {
|
||||||
|
font-size: 26rpx;
|
||||||
|
line-height: 88rpx;
|
||||||
|
padding: 30rpx;
|
||||||
|
border-bottom: 2rpx solid #ececec;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.btn {
|
||||||
|
margin: 20rpx auto;
|
||||||
|
width: 200rpx;
|
||||||
|
height: 60rpx;
|
||||||
|
background: rgba(255, 120, 15, 1);
|
||||||
|
border-radius: 30rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: rgba(255, 255, 255, 1);
|
||||||
|
line-height: 60rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.refunds-popup {
|
||||||
|
.popup-tips {
|
||||||
|
width: 420rpx;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: rgba(102, 102, 102, 1);
|
||||||
|
line-height: 42rpx;
|
||||||
|
padding: 30rpx 0;
|
||||||
|
}
|
||||||
|
.popup-btn {
|
||||||
|
width: 420rpx;
|
||||||
|
display: flex;
|
||||||
|
border-top: 2rpx solid #ececec;
|
||||||
|
> view {
|
||||||
|
flex: 1;
|
||||||
|
height: 98rpx;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 98rpx;
|
||||||
|
&:first-child {
|
||||||
|
border-right: 2rpx solid #ececec;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.determine {
|
||||||
|
color: #ff780f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
506
pages/login/agreements.vue
Normal file
@@ -1,23 +1,68 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- login页面 -->
|
<!-- login页面 -->
|
||||||
<view>
|
<view>
|
||||||
<view class="login">
|
<view class="login" @touchmove.stop.prevent="moveHandle">
|
||||||
<image class="images" src=""></image>
|
<!-- <image class="images" :src="url"></image> -->
|
||||||
<view class="backes"></view>
|
<view class="backes"></view>
|
||||||
<view class="content">
|
|
||||||
<view class="title_top">德铭阳光在线-商家端</view>
|
<view class="title_top">德铭阳光在线-商家端</view>
|
||||||
<view class="title">账号登录</view>
|
<view class="content">
|
||||||
|
<view class="title">
|
||||||
|
<view v-bind:class="[state==0 ? 'show' : '']" @click="changetab(0)">
|
||||||
|
商家登录
|
||||||
|
</view>
|
||||||
|
<view v-bind:class="[state==1 ? 'show' : '']" @click="changetab(1)">
|
||||||
|
商家达人
|
||||||
|
</view>
|
||||||
|
<view v-bind:class="[state==2 ? 'show' : '']" @click="changetab(2)">
|
||||||
|
平台达人
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="" v-if="state==0">
|
||||||
<view class="labales">
|
<view class="labales">
|
||||||
<image src=""></image>
|
<image src="../../static/image/login/login(3).png"></image>
|
||||||
<input v-model="zhanghao" type="tel" placeholder="请输入账号" />
|
<input v-model="zhanghao" type="text" @blur="getBlurVal" placeholder="请输入账号" />
|
||||||
</view>
|
</view>
|
||||||
<view class="labales">
|
<view class="labales">
|
||||||
<image src=""></image>
|
<image src="../../static/image/login/login(1).png"></image>
|
||||||
<input v-model="mima" type="password" placeholder="请输入密码" />
|
<input v-model="mima" type="password" placeholder="请输入密码" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="" v-else-if="state==1">
|
||||||
|
<view class="labales">
|
||||||
|
<image src="../../static/image/login/login(3).png"></image>
|
||||||
|
<input v-model="zhanghaoA" type="text" @blur="getBlurVal1" placeholder="请输入账号" />
|
||||||
|
</view>
|
||||||
|
<view class="labales">
|
||||||
|
<image src="../../static/image/login/login(1).png"></image>
|
||||||
|
<input v-model="mimaA" type="password" placeholder="请输入密码" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view v-else>
|
||||||
|
<view class="labales">
|
||||||
|
<image src="../../static/image/login/login(3).png"></image>
|
||||||
|
<input v-model="phone" type="number" maxlength="11" placeholder="请输入手机号" />
|
||||||
|
</view>
|
||||||
|
<view class="labales">
|
||||||
|
<image src="../../static/image/login/safe.png"></image>
|
||||||
|
<input v-model="code" type="number" placeholder="请输入验证码" />
|
||||||
|
<u-button class="get-code" :class=" is_sendcode ? 'stopClick' : '' " :disabled="is_sendcode" @click="getCode">
|
||||||
|
{{ is_sendcode ? time_count + "后可以重新发送" : "发送验证码" }}
|
||||||
|
</u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 服务协议 -->
|
||||||
|
<view class="pact">
|
||||||
|
<view class="pact-container">
|
||||||
|
<u-checkbox v-model="consentPact" shape="circle" size="30" label-size="26" icon-size="12" active-color="#ff780f">
|
||||||
|
<text>我已详细阅读并同意</text>
|
||||||
|
</u-checkbox>
|
||||||
|
<text class="pact-items" v-for="item in pactList" :key="item.id" @click="viewAgreement(item.id)"> {{ item.text }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<!-- denglu QQ weixin -->
|
<!-- denglu QQ weixin -->
|
||||||
<u-button @click="logins">{{login}}</u-button>
|
<button @click="logins">{{ login }}</button>
|
||||||
|
<!-- <u-button :custom-style="customStyle" ></u-button> -->
|
||||||
<u-toast ref="uToast" />
|
<u-toast ref="uToast" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -26,76 +71,248 @@
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
list: [{
|
list: [
|
||||||
|
{
|
||||||
checked: false,
|
checked: false,
|
||||||
disabled: false
|
disabled: false
|
||||||
}],
|
}
|
||||||
|
],
|
||||||
value: '',
|
value: '',
|
||||||
login: '登录',
|
login: '登录',
|
||||||
show: false,
|
show: false,
|
||||||
zhanghao:"",
|
zhanghao: '',
|
||||||
mima:""
|
mima: '',
|
||||||
|
zhanghaoA: '',
|
||||||
|
mimaA: '',
|
||||||
|
url: '',
|
||||||
|
phone: "",
|
||||||
|
code: "",
|
||||||
|
state:0,
|
||||||
|
clickstate:false,
|
||||||
|
// 时间
|
||||||
|
timer: null,
|
||||||
|
is_sendcode: false, // 60s
|
||||||
|
time_count: 60,
|
||||||
|
consentPact: true,
|
||||||
|
pactList: [{
|
||||||
|
id: 1,
|
||||||
|
text: "《用户协议》"
|
||||||
|
},{
|
||||||
|
id: 2,
|
||||||
|
text: "《隐私政策》"
|
||||||
|
}]
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 选中某个复选框时,由checkbox时触发
|
// 改变登陆类型
|
||||||
checkboxChange(e) {
|
changetab(num){
|
||||||
//console.log(e);
|
this.state = num
|
||||||
},
|
|
||||||
// 选中任一checkbox时,由checkbox-group触发
|
|
||||||
checkboxGroupChange(e) {
|
|
||||||
// console.log(e);
|
|
||||||
},
|
},
|
||||||
mask_u() {
|
mask_u() {
|
||||||
this.show = !this.show
|
this.show = !this.show;
|
||||||
},
|
},
|
||||||
// 获取验证码倒计时
|
// 获取验证码倒计时
|
||||||
getCode() {
|
getCode() {
|
||||||
console.log("11")
|
if (!this.$u.test.mobile(this.phone)) {
|
||||||
this.loading()
|
this.$refs.uToast.show({
|
||||||
|
title: '手机号码有误!',
|
||||||
|
})
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$u.api.getCode({
|
||||||
|
member_mobile: this.phone,
|
||||||
|
}).then(res => {
|
||||||
|
console.log(res);
|
||||||
|
if (res.errCode == 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'success',
|
||||||
|
})
|
||||||
|
this.getSendCode();
|
||||||
|
} else {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: "warning"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
loading(){
|
// 失去焦点获取数据
|
||||||
|
getBlurVal(e) {
|
||||||
|
// console.log(e.detail.value);
|
||||||
|
this.zhanghao = this.$u.trim(e.detail.value,"all");
|
||||||
|
},
|
||||||
|
getBlurVal1(e) {
|
||||||
|
this.zhanghaoA = this.$u.trim(e.detail.value,"all");
|
||||||
|
// console.log(this.$u.trim(this.zhanghaoA));
|
||||||
},
|
},
|
||||||
logins() {
|
logins() {
|
||||||
this.$u.api.login({member_name:this.zhanghao,member_password:this.mima}).then((res)=>{
|
// 检查网络
|
||||||
console.log(res)
|
uni.getNetworkType({
|
||||||
|
success: (res) => {
|
||||||
|
console.log(res.networkType);
|
||||||
|
if (res.networkType == 'none') {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: '网络似乎断开了,请检查网络后重试',
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// 不同意协议不让登录
|
||||||
|
if(!this.consentPact) return false;
|
||||||
|
|
||||||
|
// 判断是否可以点击
|
||||||
|
// console.log(this.zhanghao);
|
||||||
|
// if(this.clickstate==false){
|
||||||
|
// this.clickstate=true
|
||||||
|
// }else{
|
||||||
|
// 此验证存在逻辑问题,会出现卡死在这里的情况
|
||||||
|
// this.$refs.uToast.show({
|
||||||
|
// title: "不能重复提交",
|
||||||
|
// type: 'error'
|
||||||
|
// });
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
// 清除本地存储才可以正常登陆(具体原因没有仔细检查)
|
||||||
|
// uni.clearStorage();
|
||||||
|
// 账号登录1达人0商家
|
||||||
|
if(this.state==1){
|
||||||
|
this.$u.api.login({ member_name: this.zhanghaoA, member_password: this.mimaA }).then(res => {
|
||||||
|
console.log(JSON.stringify(res))
|
||||||
if (res.errCode != 0) {
|
if (res.errCode != 0) {
|
||||||
|
// 恢复按钮可点击状态
|
||||||
|
// this.clickstate=false
|
||||||
this.$refs.uToast.show({
|
this.$refs.uToast.show({
|
||||||
title: res.message,
|
title: res.message,
|
||||||
type: 'error'
|
type: 'error'
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
uni.setStorageSync("token",res.data.token)
|
uni.setStorageSync('token', res.data.token);
|
||||||
uni.setStorageSync("userinfo",res.data)
|
uni.setStorageSync('userinfo', res.data);
|
||||||
uni.setStorageSync('rongyun',res.data.rongcloud_token)
|
uni.setStorageSync('rongyun', res.data.rongcloud_token);
|
||||||
this.$u.route({
|
this.$u.route({
|
||||||
url:"/pages/index/index",
|
url: '/pages/user/myinfo',
|
||||||
type:"switchTab"
|
type:"redirect"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else if (this.state == 2) {
|
||||||
|
if (!this.$u.test.mobile(this.phone)) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: '手机号码有误!',
|
||||||
|
})
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.code.length < 4) {}
|
||||||
|
this.$u.api.starLogin({
|
||||||
|
member_mobile: this.phone,
|
||||||
|
sms_code: this.code,
|
||||||
|
}).then(res => {
|
||||||
|
if (res.errCode == 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'success',
|
||||||
|
})
|
||||||
|
uni.setStorageSync('token', res.data.token);
|
||||||
|
uni.setStorageSync('userinfo', res.data);
|
||||||
|
uni.setStorageSync('rongyun', res.data.rongcloud_token);
|
||||||
|
this.$u.route({
|
||||||
|
url: '/pages/user/myinfo',
|
||||||
|
type:"redirect"
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: "warning"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
} else{
|
||||||
|
this.$u.api.shoplogin({ member_name: this.zhanghao, member_password: this.mima }).then(res => {
|
||||||
|
console.log(JSON.stringify(res))
|
||||||
|
if (res.errCode != 0) {
|
||||||
|
// 恢复按钮可点击状态
|
||||||
|
// this.clickstate=false
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
uni.setStorageSync('token', res.data.token);
|
||||||
|
uni.setStorageSync('userinfo', res.data);
|
||||||
|
uni.setStorageSync('rongyun', res.data.rongcloud_token);
|
||||||
|
// this.$u.route({
|
||||||
|
// url: '/pages/index/index',
|
||||||
|
// type: 'switchTab'
|
||||||
|
// });
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/index/index',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 60s
|
||||||
|
getSendCode() {
|
||||||
|
const TIME_COUNT = 60;
|
||||||
|
if (!this.timer) {
|
||||||
|
this.time_count = TIME_COUNT;
|
||||||
|
this.is_sendcode = true;
|
||||||
|
this.timer = setInterval(() => {
|
||||||
|
if (this.time_count > 0 && this.time_count <= TIME_COUNT) {
|
||||||
|
this.time_count--;
|
||||||
|
} else {
|
||||||
|
this.is_sendcode = false;
|
||||||
|
clearInterval(this.timer);
|
||||||
|
this.timer = null;
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
moveHandle(){
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
viewAgreement(id) {
|
||||||
|
this.$u.route({
|
||||||
|
url: '/pages/login/agreements',
|
||||||
|
params: {
|
||||||
|
id: id
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
let token = uni.getStorageSync('token');
|
let token = uni.getStorageSync('token');
|
||||||
|
let user = uni.getStorageSync('userinfo');
|
||||||
|
console.log( user.role == 2 ? '/pages/index/index' : '/pages/user/myinfo')
|
||||||
if (token != undefined && token) {
|
if (token != undefined && token) {
|
||||||
this.$u.route({
|
this.$u.route({
|
||||||
url:"/pages/index/index"
|
url: user.role == 2 ? '/pages/index/index' : '/pages/user/myinfo',
|
||||||
})
|
type: user.role == 2 ? 'tab' : 'to'
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.login:before{
|
||||||
|
background: url(../../static/bg.png) no-repeat;
|
||||||
|
background-size: cover;
|
||||||
|
width: 750rpx;
|
||||||
|
height: 100vh;
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: -1;/*-1 可以当背景*/
|
||||||
|
transform: scale(1.1);
|
||||||
|
-webkit-filter: blur(3px);
|
||||||
|
filter: blur(3px);
|
||||||
|
}
|
||||||
.login {
|
.login {
|
||||||
|
|
||||||
// background: url(../../static/pageA/loginbackground.png) no-repeat!important;
|
|
||||||
.images {
|
.images {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -111,7 +328,6 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
text {
|
text {
|
||||||
@@ -144,9 +360,20 @@
|
|||||||
.title {
|
.title {
|
||||||
font-size: 36rpx;
|
font-size: 36rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin-bottom: 150rpx;
|
margin-bottom: 120rpx;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
letter-spacing: 3rpx;
|
display: flex;
|
||||||
|
justify-content: flex-start;
|
||||||
|
}
|
||||||
|
.title view{
|
||||||
|
height: 100rpx;
|
||||||
|
line-height: 100rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
padding: 0 20rpx;
|
||||||
|
}
|
||||||
|
.title .show{
|
||||||
|
font-size: 34rpx;
|
||||||
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
@@ -159,26 +386,43 @@
|
|||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.get-code {
|
||||||
|
width: auto !important;
|
||||||
|
height: 60rpx !important;
|
||||||
|
padding: 0 30rpx !important;
|
||||||
|
font-size: 24rpx !important;
|
||||||
|
line-height: 60rpx !important;
|
||||||
|
color: #fff !important;
|
||||||
|
border: none !important;
|
||||||
|
border-radius: 10rpx !important;
|
||||||
|
&::after {
|
||||||
|
border: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.labales {
|
.labales {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 90rpx;
|
||||||
|
line-height: 90rpx;
|
||||||
border-bottom: 1px #fff solid;
|
border-bottom: 1px #fff solid;
|
||||||
margin-bottom: 180rpx;
|
&:first-child {
|
||||||
height: 70rpx;
|
margin-bottom: 100rpx;
|
||||||
line-height: 70rpx;
|
}
|
||||||
position: relative;
|
&:nth-child(2) {
|
||||||
|
margin-bottom: 80rpx;
|
||||||
|
}
|
||||||
input {
|
input {
|
||||||
width: 80%;
|
width: 80%;
|
||||||
margin-left: 60rpx;
|
margin-left: 30rpx;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
letter-spacing: 2rpx;
|
letter-spacing: 2rpx;
|
||||||
background-color: none;
|
background-color: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.labales image {
|
.labales image {
|
||||||
position: absolute;
|
flex-shrink: 0;
|
||||||
left: 0;
|
width: 38rpx;
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
width: 39rpx;
|
|
||||||
height: 40rpx;
|
height: 40rpx;
|
||||||
}
|
}
|
||||||
.labales:nth-child(3) {
|
.labales:nth-child(3) {
|
||||||
@@ -198,32 +442,33 @@
|
|||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.uni-input-input, .uni-input-placeholder{
|
.uni-input-input,
|
||||||
|
.uni-input-placeholder {
|
||||||
color: #fff !important;
|
color: #fff !important;
|
||||||
letter-spacing: 2rpx;
|
letter-spacing: 2rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pact text {
|
|
||||||
font-size: 22rpx;
|
|
||||||
font-weight: 400;
|
|
||||||
color: rgba(255, 255, 255, 1);
|
|
||||||
line-height: 36px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pact_text {
|
|
||||||
font-size: 22px;
|
|
||||||
font-weight: 400;
|
|
||||||
color: rgba(129, 188, 253, 1) !important;
|
|
||||||
line-height: 36px;
|
|
||||||
}
|
|
||||||
|
|
||||||
//单选框的样式
|
|
||||||
.pact {
|
.pact {
|
||||||
position: relative;
|
width: 670rpx;
|
||||||
padding-left: 40rpx;
|
margin: 0 auto 40rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
overflow: hidden; //超出的文本隐藏
|
overflow: hidden; //超出的文本隐藏
|
||||||
text-overflow: ellipsis; //溢出用省略号显示
|
text-overflow: ellipsis; //溢出用省略号显示
|
||||||
white-space: nowrap; //溢出不换行
|
white-space: nowrap; //溢出不换行
|
||||||
|
.pact-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
/deep/ .u-checkbox {
|
||||||
|
.u-checkbox__label {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.pact-items {
|
||||||
|
color: rgba(255, 120, 15, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.u-checkbox-group {
|
.u-checkbox-group {
|
||||||
@@ -279,7 +524,6 @@
|
|||||||
width: 45rpx;
|
width: 45rpx;
|
||||||
height: 53rpx;
|
height: 53rpx;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
||||||
}
|
}
|
||||||
flex: 1;
|
flex: 1;
|
||||||
margin-top: 77rpx;
|
margin-top: 77rpx;
|
||||||
@@ -302,10 +546,10 @@
|
|||||||
color: #666;
|
color: #666;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
margin-top: 30rpx;
|
margin-top: 30rpx;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.rect_view:nth-child(1) image,.rect_view:nth-child(1) view{
|
.rect_view:nth-child(1) image,
|
||||||
|
.rect_view:nth-child(1) view {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
.rect_view:nth-child(1) image {
|
.rect_view:nth-child(1) image {
|
||||||
@@ -320,7 +564,8 @@
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
}
|
}
|
||||||
.rect_view:nth-child(2) image,.rect_view:nth-child(2) view{
|
.rect_view:nth-child(2) image,
|
||||||
|
.rect_view:nth-child(2) view {
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
.rect_view:nth-child(2) image {
|
.rect_view:nth-child(2) image {
|
||||||
@@ -336,7 +581,7 @@
|
|||||||
}
|
}
|
||||||
.title_top {
|
.title_top {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 36rpx;
|
top: calc(var(--status-bar-height) + 18px);
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
@@ -351,4 +596,16 @@
|
|||||||
background: none;
|
background: none;
|
||||||
letter-spacing: 4rpx;
|
letter-spacing: 4rpx;
|
||||||
}
|
}
|
||||||
|
button{
|
||||||
|
width: 670rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: 50rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
padding: 0 40rpx;
|
||||||
|
background-color: #ff780f;
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
70
pages/messages/info.vue
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<image :src="list.picture" class="picture" mode="widthFix"></image>
|
||||||
|
<view class="box">
|
||||||
|
<view class="info">
|
||||||
|
<text class="title u-line-2">{{ list.title }}</text>
|
||||||
|
<u-divider class="time">{{ list.addtime }}</u-divider>
|
||||||
|
<!-- <text class="time"></text> -->
|
||||||
|
</view>
|
||||||
|
<view class="content">{{ list.summary }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
id: 0,
|
||||||
|
list: [],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onLoad(option) {
|
||||||
|
// console.log(option);
|
||||||
|
this.id = option.id;
|
||||||
|
// 获取数据
|
||||||
|
this.informationList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
informationList(){
|
||||||
|
console.log(this.id)
|
||||||
|
this.$u.api.messageInfo({id:this.id}).then((res)=>{
|
||||||
|
this.list = res.data
|
||||||
|
console.log(res);
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
page {
|
||||||
|
}
|
||||||
|
.picture {
|
||||||
|
width: 750rpx;
|
||||||
|
}
|
||||||
|
.box {
|
||||||
|
width: 100%;
|
||||||
|
padding: 20rpx;
|
||||||
|
.info {
|
||||||
|
.title {
|
||||||
|
font-size: 38rpx;
|
||||||
|
color: rgba(0,0,0,.84);
|
||||||
|
line-height: 1.2;
|
||||||
|
}
|
||||||
|
.time {
|
||||||
|
padding: 40rpx 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.content {
|
||||||
|
padding: 0 6rpx;
|
||||||
|
font-size: 34rpx;
|
||||||
|
color: rgba(0,0,0,.6);
|
||||||
|
line-height: 1.4;
|
||||||
|
letter-spacing: 1rpx;
|
||||||
|
text-indent: 2rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
92
pages/messages/list.vue
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
<template>
|
||||||
|
<view class="box">
|
||||||
|
<view class="item" v-for="(item,index) in list" :key="index" @click="navto(item.id)">
|
||||||
|
<view class="time">{{item.addtime}}</view>
|
||||||
|
<view class="info">
|
||||||
|
<image class="img" :src="item.picture"></image>
|
||||||
|
<view class="title u-line-2">{{item.title}}</view>
|
||||||
|
<view class="next">
|
||||||
|
<text>查看详情</text>
|
||||||
|
<image class="right" src="@/static/image/user/1.png"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.box{
|
||||||
|
min-height: 100vh;
|
||||||
|
background-color: #EAEAEA;
|
||||||
|
.item{
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
.time{
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #666;
|
||||||
|
padding: 30rpx 0;
|
||||||
|
}
|
||||||
|
.info{
|
||||||
|
width: 690rpx;
|
||||||
|
// height: 489rpx;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
background-color: #fff;
|
||||||
|
.img{
|
||||||
|
width: 100%;
|
||||||
|
height: 280rpx;
|
||||||
|
}
|
||||||
|
.title{
|
||||||
|
height: 80rpx;
|
||||||
|
margin: 30rpx 25rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
line-height: 40rpx;
|
||||||
|
}
|
||||||
|
.next{
|
||||||
|
display: flex;
|
||||||
|
height: 84rpx;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 0 25rpx;
|
||||||
|
border-top: 1rpx solid #ebebeb;
|
||||||
|
>text{
|
||||||
|
font-size: 26rpx;
|
||||||
|
color:#666;
|
||||||
|
}
|
||||||
|
>image{
|
||||||
|
width: 9rpx;
|
||||||
|
height: 17rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data(){
|
||||||
|
return {
|
||||||
|
list:[]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(){
|
||||||
|
this.$u.api.messageList({page:1}).then((res)=>{
|
||||||
|
console.log(res)
|
||||||
|
this.list = res.data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
navto(id){
|
||||||
|
console.log(id)
|
||||||
|
this.$u.route({
|
||||||
|
url:"/pages/messages/info",
|
||||||
|
params:{
|
||||||
|
id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -1,20 +1,32 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- login页面 -->
|
<!-- login页面 -->
|
||||||
<view>
|
<view :style="{'height':swiperHeight + 'px'}">
|
||||||
<view class="border_serach">
|
<!-- <view class="border_serach">
|
||||||
<view class="u-search">
|
<view class="u-search">
|
||||||
<u-search :show-action="false" input-align="left" shape="round" placeholder="搜索" v-model="keyword"></u-search>
|
<u-search :show-action="false" input-align="left" shape="round" placeholder="搜索" v-model="keyword"></u-search>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view> -->
|
||||||
<!-- 消息列表 -->
|
<!-- 消息列表 -->
|
||||||
<view class="massage_list" v-for="(item,index) in list" :key="index">
|
<view class="massage_list" @click="navto()">
|
||||||
<view class="images">
|
<view class="images">
|
||||||
<image :src="item.url" ></image>
|
<image src="@/static/image/7.png" ></image>
|
||||||
|
</view>
|
||||||
|
<view class="names">活动消息</view>
|
||||||
|
<view class="content u-line-1">{{huodong.data.title}}</view>
|
||||||
|
<view class="times">{{huodong.data.addtime}}</view>
|
||||||
|
<view class="tishi" v-if="huodong.count != 0"></view>
|
||||||
|
</view>
|
||||||
|
<!-- <u-empty text="并没有什么消息" mode="message" v-if="Object.keys(list).length == 0" style="margin: auto"></u-empty> -->
|
||||||
|
<view class="massage_list" v-for="(item,index) in list" :key="index" @click="gochat(item)">
|
||||||
|
<view class="images">
|
||||||
|
<image :src="item.avatar" ></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="names">{{item.name}}</view>
|
<view class="names">{{item.name}}</view>
|
||||||
<view class="content">{{item.content}}</view>
|
<view class="content u-line-1">{{item.text}}</view>
|
||||||
<view class="times">{{item.time}}</view>
|
<view class="times">{{item.time}}</view>
|
||||||
|
<view class="tishi" v-if="item.unReadMessage"></view>
|
||||||
</view>
|
</view>
|
||||||
|
<u-toast ref="uToast" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
@@ -22,37 +34,68 @@
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
keyword: '搜索',
|
keyword: '搜索',
|
||||||
list: [{
|
list: [
|
||||||
name: '瘦瘦',
|
|
||||||
content: "木糖少女小紫薯西装领连衣裙夏季新款女装装领连衣裙夏季装领连衣裙夏季装领连衣裙夏季夏收腰格子格纹裙子",
|
|
||||||
url: '../../static/image/tosign/tosigin(5).png',
|
|
||||||
id : '1',
|
|
||||||
time : '10:15'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '瘦瘦',
|
|
||||||
content: "木糖少女小紫薯西装领连衣裙夏季新款女装装领连衣裙夏季装领连衣裙夏季装领连衣裙夏季夏收腰格子格纹裙子",
|
|
||||||
url: '../../static/image/tosign/tosigin(5).png',
|
|
||||||
id : '1',
|
|
||||||
time : '10:15'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '瘦瘦',
|
|
||||||
content: "木糖少女小紫薯西装领连衣裙夏季新款女装装领连衣裙夏季装领连衣裙夏季装领连衣裙夏季夏收腰格子格纹裙子",
|
|
||||||
url: '../../static/image/tosign/tosigin(5).png',
|
|
||||||
id : '1',
|
|
||||||
time : '10:15'
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
|
huodong:{
|
||||||
|
data:{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
gochat(id){
|
||||||
|
console.log(id)
|
||||||
|
this.$u.route({
|
||||||
|
url:"/pages/messages/privateChat",
|
||||||
|
params:{
|
||||||
|
id:JSON.stringify(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onFriendListChange(onlineFriends) {
|
||||||
|
//todo:比较垃圾的处理方式,因为Uniapp的基于MAP的双向绑定在H5端不稳定,H5端偶尔会抽风
|
||||||
|
// 下边这一行删掉,有时候页面可以更新,有时候不行,大家有优雅的方式,也欢迎跟我们沟通
|
||||||
|
console.log(onlineFriends,121212)
|
||||||
|
this.information_dl = onlineFriends;
|
||||||
|
|
||||||
|
this.$forceUpdate();
|
||||||
|
},
|
||||||
|
navto(){
|
||||||
|
console.log(1212)
|
||||||
|
this.$u.route({
|
||||||
|
url:"/pages/messages/list"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onShow(){
|
||||||
|
// this.list = this.imService.friends;
|
||||||
|
this.imService.onFriendListChange=this.onFriendListChange;
|
||||||
|
},
|
||||||
|
onLoad(){
|
||||||
|
const res = uni.getSystemInfoSync();
|
||||||
|
this.swiperHeight = res.windowHeight;
|
||||||
|
this.list = this.imService.friends;
|
||||||
|
this.$u.api.isread().then((res)=>{
|
||||||
|
console.log(res)
|
||||||
|
this.huodong = res.data
|
||||||
|
})
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.tishi{
|
||||||
|
position: absolute;
|
||||||
|
bottom: 30rpx;
|
||||||
|
right: 30rpx;
|
||||||
|
width: 12rpx;
|
||||||
|
height: 12rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: #FF0000;
|
||||||
|
}
|
||||||
.u-search{
|
.u-search{
|
||||||
width: 690rpx;
|
width: 690rpx;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
@@ -66,6 +109,7 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
border-bottom: 1px #ECECEC solid;
|
border-bottom: 1px #ECECEC solid;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
zoom: 1;
|
zoom: 1;
|
||||||
.images{
|
.images{
|
||||||
width: 84rpx;
|
width: 84rpx;
|
||||||
@@ -93,10 +137,7 @@
|
|||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
color: #666666;
|
color: #666666;
|
||||||
height: 30rpx;
|
height: 30rpx;
|
||||||
height: 30rpx;
|
line-height: 30rpx;
|
||||||
overflow:hidden; //超出的文本隐藏
|
|
||||||
text-overflow:ellipsis; //用省略号显示
|
|
||||||
white-space:nowrap; //不换行
|
|
||||||
}
|
}
|
||||||
.times{
|
.times{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
617
pages/messages/privateChat.vue
Normal file
@@ -0,0 +1,617 @@
|
|||||||
|
<template>
|
||||||
|
<div class="chatInterface">
|
||||||
|
<div class="chat-scroll-container">
|
||||||
|
<scroll-view ref="myScroll" scroll-y="true" class="scroll-view" :scroll-into-view="contentPosition">
|
||||||
|
<div :class="[allHistoryLoaded ? 'top gray' : 'top']" @click="loadMoreHistoryMessage">
|
||||||
|
<span class="description">{{allHistoryLoaded ? '已经没有更多的历史消息' : '点击加载更多历史消息'}}</span>
|
||||||
|
</div>
|
||||||
|
<!--已经收到的消息-->
|
||||||
|
<div v-for="(message, key) in messages || []"
|
||||||
|
:id="'message_' + message.timestamp"
|
||||||
|
:key="message.timestamp"
|
||||||
|
class = "message-item"
|
||||||
|
:class="{'self' : message.senderId == (currentUser && currentUser.uuid)}">
|
||||||
|
<div :class="friend.online ? 'avatar' : 'avatar offline-gray'"
|
||||||
|
v-if="message.senderId != (currentUser && currentUser.uuid)">
|
||||||
|
<image :src="friend.avatar" ></image>
|
||||||
|
</div>
|
||||||
|
<div class="avatar" v-else>
|
||||||
|
<image :src="currentUser.avatar"></image>
|
||||||
|
</div>
|
||||||
|
<div class="content">
|
||||||
|
<span class="text-content" v-if="message.type =='text'">{{message.payload.text}}</span>
|
||||||
|
<image class="image-content" v-if="message.type == 'image'" :src="message.payload.url" :data-url="message.payload.url" @click="showImageFullScreen" mode="widthFix" @load="scrollToBottom"></image>
|
||||||
|
<div class="video-snapshot" v-if="message.type == 'video'" :data-url="message.payload.video.url" @click="playVideo">
|
||||||
|
<image :src="message.payload.thumbnail.url" mode="aspectFit" @load="scrollToBottom"></image>
|
||||||
|
<div class="video-play-icon"></div>
|
||||||
|
</div>
|
||||||
|
<GoEasyAudioPlayer v-if="message.type =='audio'" :src="message.payload.url" :duration="message.payload.duration" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--发送中的消息-->
|
||||||
|
<div v-for="(message, index) in pendingMessages || []"
|
||||||
|
:key="index"
|
||||||
|
:id="'pendingMessage_' + index"
|
||||||
|
class = "message-item"
|
||||||
|
:class="{'self' : message.senderId == (currentUser && currentUser.uuid)}">
|
||||||
|
<div :class="friend.online ? 'avatar' : 'avatar offline-gray'"
|
||||||
|
v-if="message.senderId != (currentUser && currentUser.uuid)">
|
||||||
|
<image :src="friend.avatar"></image>
|
||||||
|
</div>
|
||||||
|
<div class="avatar" v-else>
|
||||||
|
<image :src="currentUser.avatar"></image>
|
||||||
|
</div>
|
||||||
|
<div class="content">
|
||||||
|
<b class="pending"></b>
|
||||||
|
<span class="text-content" v-if="message.type =='text'">{{message.payload.text}}</span>
|
||||||
|
<image class="image-content" v-if="message.type == 'image'" :src="message.payload.url" mode="widthFix" @load="scrollToBottom"></image>
|
||||||
|
<div v-if="message.type == 'video'" class="video-snapshot">
|
||||||
|
<image :src="message.payload.thumbnail.url" mode="aspectFit" @load="scrollToBottom"></image>
|
||||||
|
<div class="video-play-icon"></div>
|
||||||
|
</div>
|
||||||
|
<GoEasyAudioPlayer v-if="message.type =='audio'" :src="message.payload.url" :duration="message.payload.duration" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</scroll-view>
|
||||||
|
</div>
|
||||||
|
<div class="action-box" v-if="!video.visible">
|
||||||
|
<div class="action-top">
|
||||||
|
<div :class="[audio.visible ? 'record-icon record-open':'record-icon']" @click="switchAudioKeyboard"></div>
|
||||||
|
<div class="record-input" @longpress="onRecordStart" @touchend="onRecordEnd" v-if="audio.visible" >{{audio.recording ? '松开发送' : '按住录音'}}</div>
|
||||||
|
<div class="message-input" v-else>
|
||||||
|
<input type="text" placeholder="发送消息" v-model="content">
|
||||||
|
</div>
|
||||||
|
<div class="file-icon img-video" @click="sendImage"></div>
|
||||||
|
<div class="file-icon" @click="sendVideo"></div>
|
||||||
|
<span class="send-message-btn" @click="sendMessage">发送</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="record-loading" v-if="audio.recording"></div>
|
||||||
|
<video style="width:100%;height: 100%" :src="video.url" v-if="video.visible" id="videoPlayer" autoplay="true" @fullscreenchange="onVideoFullScreenChange" @play="onVideoPlayStart"></video>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import GoEasyAudioPlayer from "../../components/GoEasyAudioPlayer/GoEasyAudioPlayer";
|
||||||
|
const recorderManager = uni.getRecorderManager();
|
||||||
|
export default {
|
||||||
|
name: "privateChat",
|
||||||
|
components : {
|
||||||
|
GoEasyAudioPlayer,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
//聊天文本框
|
||||||
|
content: '',
|
||||||
|
friend: null,
|
||||||
|
currentUser: null,
|
||||||
|
//已经接收到的消息
|
||||||
|
messages: [],
|
||||||
|
//正在发送中的消息
|
||||||
|
pendingMessages : [],
|
||||||
|
//已经加载完所有历史消息
|
||||||
|
allHistoryLoaded: false,
|
||||||
|
|
||||||
|
contentPosition : '',
|
||||||
|
|
||||||
|
audio : {
|
||||||
|
//语音录音中
|
||||||
|
recording : false,
|
||||||
|
//录音按钮展示
|
||||||
|
visible : false
|
||||||
|
},
|
||||||
|
video : {
|
||||||
|
visible : false,
|
||||||
|
url : '',
|
||||||
|
context : null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch : {
|
||||||
|
//每当新增了发送中的消息,都滑动到底部
|
||||||
|
pendingMessages(){
|
||||||
|
this.scrollToBottom()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onReady () {
|
||||||
|
this.video.context = uni.createVideoContext('videoPlayer');
|
||||||
|
},
|
||||||
|
onLoad(options) {
|
||||||
|
if(!this.imService.currentUser){
|
||||||
|
uni.navigateTo({
|
||||||
|
url : '../login/login'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//对话数据
|
||||||
|
this.friend = JSON.parse(options.id);
|
||||||
|
this.currentUser = this.imService.currentUser;
|
||||||
|
let privateMessages = this.imService.getPrivateMessages(this.friend.uuid);
|
||||||
|
this.imService.uid = this.friend.uuid;
|
||||||
|
this.messages = privateMessages.sentMessages;
|
||||||
|
this.pendingMessages = privateMessages.pendingMessages;
|
||||||
|
|
||||||
|
uni.setNavigationBarTitle({
|
||||||
|
title : this.friend.name
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.setNavigationBarColor({
|
||||||
|
backgroundColor : '#FF780F',
|
||||||
|
frontColor : '#333333'
|
||||||
|
});
|
||||||
|
}, 10);
|
||||||
|
|
||||||
|
this.initialListeners();
|
||||||
|
|
||||||
|
//每次进入聊天页面,总是滚动到底部
|
||||||
|
this.scrollToBottom()
|
||||||
|
|
||||||
|
},
|
||||||
|
onUnload() {
|
||||||
|
//退出聊天页面之前,清空页面传入的监听器
|
||||||
|
this.imService.onNewPrivateMessageReceive = (friendId, message)=> {};
|
||||||
|
this.imService.onPrivateHistoryLoad = (friendId, messages) =>{};
|
||||||
|
//将未读消息数清零
|
||||||
|
this.imService.resetFriendUnReadMessage(this.friend);
|
||||||
|
this.imService.uid = 0;
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
initialListeners () {
|
||||||
|
//传入监听器,收到一条私聊消息总是滚到到页面底部
|
||||||
|
this.imService.onNewPrivateMessageReceive = (friendId, message)=> {
|
||||||
|
if (friendId == this.friend.uuid) {
|
||||||
|
//收到新消息,是滚动到最底部
|
||||||
|
this.scrollToBottom()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//传入监听器,完成一次私聊历史加载时,如果加载结果为空,显示没有更多消息
|
||||||
|
this.imService.onPrivateHistoryLoad = (friendId, messages) =>{
|
||||||
|
if (messages.length == 0) {
|
||||||
|
//灰色,就不能点击了
|
||||||
|
this.allHistoryLoaded = true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// 录音监听器
|
||||||
|
this.initRecorderListeners();
|
||||||
|
},
|
||||||
|
initRecorderListeners(){
|
||||||
|
var self = this;
|
||||||
|
// 监听录音开始
|
||||||
|
recorderManager.onStart(function(){
|
||||||
|
self.audio.recording = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
//录音结束后,发送
|
||||||
|
recorderManager.onStop(function(res){
|
||||||
|
self.audio.recording = false;
|
||||||
|
self.imService.sendPrivateAudioMessage(self.friend.uuid, res)
|
||||||
|
});
|
||||||
|
|
||||||
|
// 监听录音报错
|
||||||
|
recorderManager.onError(function(res){
|
||||||
|
console.log("录音报错:",res);
|
||||||
|
})
|
||||||
|
},
|
||||||
|
sendMessage() {//发送消息
|
||||||
|
if (this.content.trim() != '') {
|
||||||
|
this.imService.sendPrivateTextMessage(this.friend.uuid, this.content);
|
||||||
|
let that = this
|
||||||
|
setTimeout(function(){
|
||||||
|
that.scrollToBottom();
|
||||||
|
},500)
|
||||||
|
}
|
||||||
|
this.content = "";
|
||||||
|
},
|
||||||
|
loadMoreHistoryMessage() {//历史消息
|
||||||
|
let lastMessageTimeStamp = Date.now();
|
||||||
|
let lastMessage = this.messages[0];
|
||||||
|
if (lastMessage) {
|
||||||
|
lastMessageTimeStamp = lastMessage.timestamp;
|
||||||
|
}
|
||||||
|
this.imService.loadPrivateHistoryMessage(this.friend.uuid, lastMessageTimeStamp);
|
||||||
|
},
|
||||||
|
onRecordStart () {
|
||||||
|
try{
|
||||||
|
recorderManager.start();
|
||||||
|
}catch(e){
|
||||||
|
console.log("e:",e);
|
||||||
|
uni.showModal({
|
||||||
|
title: '录音错误',
|
||||||
|
content : '请在app和小程序端体验录音,Uni官方明确H5不支持getRecorderManager, 详情查看Uni官方文档'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onRecordEnd () {
|
||||||
|
try{
|
||||||
|
recorderManager.stop();
|
||||||
|
}catch(e){
|
||||||
|
console.log("e:",e);
|
||||||
|
uni.showModal({
|
||||||
|
title: '录音错误',
|
||||||
|
content : '请在app和小程序端体验录音,Uni官方明确H5不支持getRecorderManager, 详情查看Uni官方文档'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sendVideo () {//发送文件
|
||||||
|
uni.chooseVideo({
|
||||||
|
success : (res) => {
|
||||||
|
console.log(res)
|
||||||
|
this.imService.sendPrivateVideoMessage(this.friend.uuid, res)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
sendImage() {
|
||||||
|
uni.chooseImage({
|
||||||
|
count :1,
|
||||||
|
success :(res) => {
|
||||||
|
console.log(res)
|
||||||
|
this.imService.sendPrivateImageMessage(this.friend.uuid,res);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
showImageFullScreen (e) {
|
||||||
|
var imagesUrl = [e.currentTarget.dataset.url];
|
||||||
|
uni.previewImage({
|
||||||
|
urls: imagesUrl
|
||||||
|
});
|
||||||
|
},
|
||||||
|
//语音录制按钮和键盘输入的切换
|
||||||
|
switchAudioKeyboard() {
|
||||||
|
this.audio.visible = !this.audio.visible;
|
||||||
|
},
|
||||||
|
playVideo (e) {
|
||||||
|
this.video.visible = true;
|
||||||
|
this.video.url =e.currentTarget.dataset.url;
|
||||||
|
},
|
||||||
|
onVideoPlayStart () {
|
||||||
|
this.video.context.requestFullScreen({
|
||||||
|
direction : 0
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onVideoFullScreenChange (e) {
|
||||||
|
//当退出全屏播放时,隐藏播放器
|
||||||
|
if(this.video.visible && !e.detail.fullScreen){
|
||||||
|
this.video.visible = false;
|
||||||
|
this.video.context.stop();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
scrollToBottom () {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if(this.messages && this.messages.length !=0){
|
||||||
|
this.contentPosition = 'message_' + (this.messages[this.messages.length-1].timestamp || '');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style >
|
||||||
|
page {
|
||||||
|
height: 100%;;
|
||||||
|
}
|
||||||
|
uni-page-body, uni-page-refresh {
|
||||||
|
height: 100%;;
|
||||||
|
}
|
||||||
|
.chatInterface{
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
.chatInterface .chat-scroll-container{
|
||||||
|
overflow: hidden;
|
||||||
|
padding-left: 20rpx;
|
||||||
|
padding-right: 20rpx;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.chatInterface .scroll-view{
|
||||||
|
flex: 1;
|
||||||
|
overflow: auto;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.chatInterface .top{
|
||||||
|
font-size: 20rpx;
|
||||||
|
height: 90rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
-webkit-tap-highlight-color: transparent;
|
||||||
|
color: blue;
|
||||||
|
}
|
||||||
|
.chatInterface .top .description{
|
||||||
|
/* text-decoration: underline; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.chatInterface .message-item{
|
||||||
|
/* max-height: 400rpx; */
|
||||||
|
margin-top: 40rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.chatInterface .avatar{
|
||||||
|
width: 80rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
margin-right:20rpx ;
|
||||||
|
}
|
||||||
|
.chatInterface .message-item.self .avatar{
|
||||||
|
margin-left: 20rpx;
|
||||||
|
}
|
||||||
|
.chatInterface .message-item .avatar image{
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chatInterface .content{
|
||||||
|
font-size: 34rpx;
|
||||||
|
line-height: 44rpx;
|
||||||
|
/* max-height: 400rpx; */
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: right;
|
||||||
|
}
|
||||||
|
.chatInterface .content .image-content{
|
||||||
|
padding: 16rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
width: 300rpx;
|
||||||
|
height: 300rpx;
|
||||||
|
}
|
||||||
|
.chatInterface .content .text-content{
|
||||||
|
padding: 16rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
max-width: 520rpx;
|
||||||
|
}
|
||||||
|
.chatInterface .content .pending{
|
||||||
|
background: url("../../static/images/pending.gif") no-repeat center;
|
||||||
|
background-size: 30rpx;
|
||||||
|
width: 30rpx;
|
||||||
|
height: 30rpx;
|
||||||
|
margin-right: 10rpx;
|
||||||
|
flex-grow: 0;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chatInterface .action-box{
|
||||||
|
display: flex;
|
||||||
|
height: 80rpx;
|
||||||
|
padding-top: 20rpx;
|
||||||
|
padding-bottom: 20rpx;
|
||||||
|
backdrop-filter: blur(0.27rpx);
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.chatInterface .action-top{
|
||||||
|
display: flex;
|
||||||
|
padding-top: 20rpx;
|
||||||
|
padding-bottom: 20rpx;
|
||||||
|
backdrop-filter: blur(0.27rem);
|
||||||
|
height: 80rpx;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.chatInterface .record-icon{
|
||||||
|
font-size: 32rpx;
|
||||||
|
width: 80rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
line-height: 80rpx;
|
||||||
|
text-align: center;
|
||||||
|
background: url("../../static/images/record-appearance-icon.png") no-repeat center;
|
||||||
|
background-size: 50%;
|
||||||
|
-webkit-tap-highlight-color:rgba(0,0,0,0);
|
||||||
|
}
|
||||||
|
.chatInterface .action-top .file-icon{
|
||||||
|
background: url("../../static/images/vedio.png") no-repeat center;
|
||||||
|
background-size: 70%;
|
||||||
|
color: #9D9D9D;
|
||||||
|
position: relative;
|
||||||
|
width:80rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
line-height: 80rpx;
|
||||||
|
-webkit-tap-highlight-color:rgba(0,0,0,0);
|
||||||
|
}
|
||||||
|
.chatInterface .record-icon.record-open{
|
||||||
|
background: url("../../static/images/jianpan.png") no-repeat center;
|
||||||
|
background-size: 70%;
|
||||||
|
-webkit-tap-highlight-color:rgba(0,0,0,0);
|
||||||
|
}
|
||||||
|
.chatInterface .action-top .img-video{
|
||||||
|
background: url("../../static/images/file.png") no-repeat center;
|
||||||
|
background-size: 74%;
|
||||||
|
}
|
||||||
|
.chatInterface .record-input{
|
||||||
|
width: 480rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
line-height: 80rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
background: #cccccc;
|
||||||
|
color: #ffffff;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.chatInterface .message-input{
|
||||||
|
border-radius: 12rpx;
|
||||||
|
}
|
||||||
|
.chatInterface .message-input input{
|
||||||
|
width: 440rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
line-height: 80rpx;
|
||||||
|
padding-left: 20rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
.chatInterface .send-message-btn{
|
||||||
|
font-size: 32rpx;
|
||||||
|
width: 80rpx;
|
||||||
|
line-height: 80rpx;
|
||||||
|
}
|
||||||
|
.record-loading{
|
||||||
|
position: absolute;
|
||||||
|
top:50%;
|
||||||
|
left: 50%;
|
||||||
|
width: 300rpx;
|
||||||
|
height: 300rpx;
|
||||||
|
margin: -150rpx -150rpx;
|
||||||
|
background: #262628;
|
||||||
|
background: url("../../static/images/recording-loading.gif") no-repeat center;
|
||||||
|
background-size: 100%;
|
||||||
|
border-radius: 40rpx;
|
||||||
|
}
|
||||||
|
.chatInterface .img-layer{
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background: #000000;
|
||||||
|
z-index: 9999;
|
||||||
|
padding: 6rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.chatInterface .img-layer uni-image {
|
||||||
|
height: 100%!important;
|
||||||
|
}
|
||||||
|
.chatInterface .img-layer {
|
||||||
|
height: 100%!important;
|
||||||
|
width: 100%!important;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.chatInterface .content .file-content .file-info{
|
||||||
|
height: 0.5rem;
|
||||||
|
width: 1.5rem;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 0 0.1rem;
|
||||||
|
}
|
||||||
|
.chatInterface .content .file-content .file-info .title{
|
||||||
|
height: 0.3rem;
|
||||||
|
line-height: 0.3rem;
|
||||||
|
overflow: hidden;
|
||||||
|
font-size: 0.16rem;
|
||||||
|
padding: 0;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
word-break: break-all;
|
||||||
|
color: #262628;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
.chatInterface .content .file-content .file-info .size{
|
||||||
|
font-size: 0.14rem;
|
||||||
|
height: 0.2rem;
|
||||||
|
line-height: 0.2rem;
|
||||||
|
padding: 0;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
word-break: break-all;
|
||||||
|
color: #999999;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
.chatInterface .video-snapshot{
|
||||||
|
position: relative;
|
||||||
|
height: 300rpx;
|
||||||
|
max-width: 400rpx;
|
||||||
|
background: #000000;
|
||||||
|
}
|
||||||
|
.chatInterface .video-snapshot image{
|
||||||
|
max-height: 300rpx;
|
||||||
|
max-width: 400rpx;
|
||||||
|
}
|
||||||
|
.chatInterface .video-snapshot video{
|
||||||
|
max-height: 300rpx;
|
||||||
|
max-width: 400rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.video-snapshot .video-play-icon{
|
||||||
|
position: absolute;
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
background:url("../../static/images/play.png") no-repeat center;
|
||||||
|
background-size: 100%;
|
||||||
|
top:50%;
|
||||||
|
left: 50%;
|
||||||
|
margin:-20rpx;
|
||||||
|
}
|
||||||
|
.chatInterface .avatar{
|
||||||
|
overflow: hidden;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.chatInterface .avatar img{
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.chatInterface .content{
|
||||||
|
float: left;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.chatInterface .content span{
|
||||||
|
font-family: Source Han Sans CN;
|
||||||
|
letter-spacing: -0.41px;
|
||||||
|
color: #262628;
|
||||||
|
background: #efefef;
|
||||||
|
display: inline-block;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
.chatInterface .message-item.self{
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
.chatInterface .message-item.self .avatar{
|
||||||
|
margin-right: 0;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
.chatInterface .message-item.self .content{
|
||||||
|
text-align: right;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
.chatInterface .message-item.self .content span{
|
||||||
|
color: #ffffff;
|
||||||
|
background:#FF780F;
|
||||||
|
word-break: break-all;
|
||||||
|
text-align: left;
|
||||||
|
max-width: 520rpx;
|
||||||
|
}
|
||||||
|
.chatInterface .action-box{
|
||||||
|
background: #FAFAFA;
|
||||||
|
display: flex;
|
||||||
|
align-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.chatInterface .message-input{
|
||||||
|
background: #efefef;
|
||||||
|
border: 0;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chatInterface .send-message-btn{
|
||||||
|
flex-grow: 1;
|
||||||
|
text-align: center;
|
||||||
|
color: #95949A;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chatInterface .member-layer{
|
||||||
|
width:100%;
|
||||||
|
height: 100%;
|
||||||
|
background: #FFFFFF;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
.member-layer .member{
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chatInterface .group-icon{
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chatInterface .gray{
|
||||||
|
color: gray!important;
|
||||||
|
text-decoration: none!important;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -1,74 +1,98 @@
|
|||||||
<template>
|
<template>
|
||||||
<view id="release">
|
<view id="release">
|
||||||
<u-form :model="form" ref="uForm">
|
<u-form :model="form" ref="uForm">
|
||||||
<u-form-item label="标题" label-position="right">
|
<u-form-item label="标题" label-position="right"><u-input v-model="form.name" placeholder="请输入标题" /></u-form-item>
|
||||||
<u-input v-model="form.name" placeholder="请输入标题" />
|
<!-- form-data -->
|
||||||
</u-form-item>
|
<view class="titles">封面<text>(建议图片尺寸为334*334)</text></view>
|
||||||
<view class="titles">图片</view>
|
<u-upload
|
||||||
<u-upload :action="action" del-color="#ececec" upload-text="选择图片" del-bg-color="#fff" :file-list="fileList"></u-upload>
|
:form-data="coverformdata"
|
||||||
|
:max-count="1"
|
||||||
|
:header="header"
|
||||||
|
name="article_cover"
|
||||||
|
:action="action"
|
||||||
|
del-color="#ececec"
|
||||||
|
upload-text="选择图片"
|
||||||
|
del-bg-color="#fff"
|
||||||
|
:file-list="fileListA"
|
||||||
|
@on-success="uploadcover"
|
||||||
|
></u-upload>
|
||||||
|
<view class="titles">图片<text>(最多选择5张图片,建议图片尺寸为750*700)</text></view>
|
||||||
|
<u-upload
|
||||||
|
:form-data="imgformdata"
|
||||||
|
name="article_image"
|
||||||
|
:header="header"
|
||||||
|
:action="action"
|
||||||
|
@on-success="uploadphoto"
|
||||||
|
del-color="#ececec"
|
||||||
|
upload-text="选择图片"
|
||||||
|
del-bg-color="#fff"
|
||||||
|
:max-count="5"
|
||||||
|
:file-list="fileListB"
|
||||||
|
></u-upload>
|
||||||
<!-- 标签 -->
|
<!-- 标签 -->
|
||||||
<view>
|
<view>
|
||||||
<view class="titles">标签</view>
|
<view class="titles flex-title">
|
||||||
<view class="form-view" @click="show_add()">+ 新建标签</view>
|
<text>标签</text>
|
||||||
<view class="form-view" v-for="(item,index) in fileListes" :key="index">{{item}}</view>
|
<text @click="editing">{{ is_edit ? "取消编辑" : "编辑" }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="form-view active" @click="show_add()">+ 新建标签</view>
|
||||||
|
<view :class="['form-view', item.state == true ? 'active' : '']" v-for="(item, index) in fileListes" :key="index" @click="changeselect(index)">
|
||||||
|
{{ item.name }}
|
||||||
|
<u-icon v-show="is_edit && item.user_id != 0" class="close" name="close" color="#666" size="18" @click="isTable(item.id,index)"></u-icon>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 简介 -->
|
<!-- 简介 -->
|
||||||
<view class="titles">简介</view>
|
<view class="titles">简介</view>
|
||||||
<view class="titles_border">
|
<view class="titles_border"><textarea placeholder="请输入内容..." v-model="form.intro"></textarea></view>
|
||||||
<textarea placeholder="请输入内容..."></textarea>
|
|
||||||
</view>
|
|
||||||
<!-- 底部弹框 商品选择 -->
|
<!-- 底部弹框 商品选择 -->
|
||||||
<view class="show_two">
|
<view class="show_two">
|
||||||
<u-popup v-model="show_two" mode="bottom" :closeable="true">
|
<u-popup v-model="show_two" mode="bottom" :closeable="true">
|
||||||
<view class="title">
|
<view class="title"><text>选择商品</text></view>
|
||||||
<text>选择商品</text>
|
|
||||||
</view>
|
|
||||||
<!-- 商品列表 -->
|
<!-- 商品列表 -->
|
||||||
|
<scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll">
|
||||||
<view class="listes_shoping" v-for="(item, index) in list" :key="index">
|
<view class="listes_shoping" v-for="(item, index) in list" :key="index">
|
||||||
<view>
|
<view>
|
||||||
<u-checkbox-group @change="checkboxGroupChange">
|
<u-checkbox-group>
|
||||||
<u-checkbox @change="checkboxChange" shape="circle" active-color="#FF780F" v-model="item.checked" :name="item.id"></u-checkbox>
|
<u-checkbox
|
||||||
|
shape="circle"
|
||||||
|
size="40"
|
||||||
|
active-color="#FF780F"
|
||||||
|
v-model="item.checked"
|
||||||
|
:name="index"
|
||||||
|
@change="checkboxChange"
|
||||||
|
></u-checkbox>
|
||||||
</u-checkbox-group>
|
</u-checkbox-group>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view><image :src="item.goods_image" mode="widthFix"></image></view>
|
||||||
<image :src="item.url" mode="widthFix"></image>
|
<view class="contentes">{{ item.goods_name }}</view>
|
||||||
</view>
|
|
||||||
<view class="contentes">{{item.content}}</view>
|
|
||||||
</view>
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
|
||||||
<!-- 提交按钮 -->
|
<!-- 提交按钮 -->
|
||||||
<view class="u-button" @click="changes()">确定</view>
|
<view class="u-button" @click="changes()">确定</view>
|
||||||
</u-popup>
|
</u-popup>
|
||||||
<!-- 底部选择商品列表 -->
|
<!-- 底部选择商品列表 -->
|
||||||
<view @click="show_two = true">选择商品
|
<view @click="show_two = true" v-if="userinfo.role != 4">
|
||||||
|
选择商品
|
||||||
<image class="images" src="../../static/image/tosign/bhottom.png"></image>
|
<image class="images" src="../../static/image/tosign/bhottom.png"></image>
|
||||||
</view>
|
</view>
|
||||||
<!-- 选择后的列表 -->
|
<!-- 选择后的列表 -->
|
||||||
<view class="List_tosign" v-if="List_tosign != ''">
|
<view class="List_tosign" v-for="list in shoplist">
|
||||||
<view>
|
<view><image :src="list.goods_image" mode="scaleToFill"></image></view>
|
||||||
<image src="../../static/image/tosign/tosigin(5).png" mode="scaleToFill"></image>
|
<view>{{ list.goods_name }}</view>
|
||||||
</view>
|
<view><image src="../../static/image/tosign/delete.png" mode="widthFix" @click="delarr(list.goods_id)"></image></view>
|
||||||
<view>
|
|
||||||
木糖少女小紫薯西装领连衣裙夏季新款女装夏收腰格子格纹裙子
|
|
||||||
</view>
|
|
||||||
<view>
|
|
||||||
<image src="../../static/image/tosign/delete.png" mode="widthFix"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 提交 -->
|
<!-- 提交 -->
|
||||||
<u-button class="custom-style" shape="circle" size="default">发表</u-button>
|
<u-button :hair-line="false" class="custom-style" shape="circle" size="default" @click="publish">发表</u-button>
|
||||||
|
|
||||||
</u-form>
|
</u-form>
|
||||||
<!-- 添加标签的按钮 -->
|
<!-- 添加标签的按钮 -->
|
||||||
<u-popup v-model="show" mode="center" border-radius="14">
|
<u-popup v-model="show" mode="center" border-radius="14">
|
||||||
<view class="text">
|
<view class="text">创建属于你的标签吧</view>
|
||||||
创建属于你的标签吧
|
<view class="u-inputes"><u-input v-model="tagcontent" /></view>
|
||||||
</view>
|
<u-button :hair-line="false" class="custom-style-button" shape="circle" size="default" @click="addLiveSpec">确定</u-button>
|
||||||
<view class="u-inputes">
|
|
||||||
<u-input v-model="form.name" />
|
|
||||||
</view>
|
|
||||||
<u-button class="custom-style-button" shape="circle" size="default">确定</u-button>
|
|
||||||
</u-popup>
|
</u-popup>
|
||||||
|
<u-toast ref="uToast" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -82,123 +106,326 @@
|
|||||||
sex: ''
|
sex: ''
|
||||||
},
|
},
|
||||||
// 演示地址,请勿直接使用
|
// 演示地址,请勿直接使用
|
||||||
action: 'http://www.example.com/upload',
|
action: 'https://mall.dmygkeji.com/storeapi/Upload/uploadFile',
|
||||||
fileList: [],
|
coverformdata: {
|
||||||
fileListes: ["美妆", "博主穿搭", "美妆", "美妆", "美妆", "美妆", "美妆", "博主穿搭"],
|
name: 'article_cover'
|
||||||
|
},
|
||||||
|
imgformdata: {
|
||||||
|
name: 'article_image'
|
||||||
|
},
|
||||||
|
fileListA: [],
|
||||||
|
fileListB: [],
|
||||||
|
imgarrA: [],
|
||||||
|
imgarrB: [],
|
||||||
|
header: {
|
||||||
|
Authorization: 'Bearer' + ' ' + uni.getStorageSync('token')
|
||||||
|
},
|
||||||
|
fileListes: [],
|
||||||
show: false,
|
show: false,
|
||||||
show_two: false,
|
show_two: false,
|
||||||
filesList: [],
|
filesList: [],
|
||||||
arres_list: [],
|
arres_list: [],
|
||||||
|
shoplist: [],
|
||||||
checked: false,
|
checked: false,
|
||||||
list: [{
|
list: [],
|
||||||
name: 'apple',
|
List_tosign: [],
|
||||||
checked: false,
|
flagA: true,
|
||||||
disabled: false,
|
flagB: false,
|
||||||
content: "木糖少女小紫薯西装领连衣裙夏季新款女装装领连衣裙夏季装领连衣裙夏季装领连衣裙夏季夏收腰格子格纹裙子",
|
scrollTop: 0,
|
||||||
url: '../../static/image/tosign/tosigin(5).png',
|
imgarr: [], //上传图片数组
|
||||||
id : '1'
|
cover: '', //图文封面
|
||||||
},
|
selectarr: [], //选中标签
|
||||||
{
|
tagcontent: '',
|
||||||
name: 'apple2',
|
is_edit: false, // 编辑
|
||||||
checked: false,
|
userinfo:{},
|
||||||
disabled: false,
|
device: null, // 手机信息
|
||||||
content: "木糖少女小紫薯西装领连衣裙夏季新款女装夏收腰格子格纹裙子",
|
};
|
||||||
url: '../../static/image/tosign/tosigin(5).png',
|
|
||||||
id : '2'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'appl3e',
|
|
||||||
checked: false,
|
|
||||||
disabled: false,
|
|
||||||
content: "木糖少女小紫薯西装领连衣裙夏季新款女装夏收腰格子格纹裙子",
|
|
||||||
url: '../../static/image/tosign/tosigin(5).png',
|
|
||||||
id : '3'
|
|
||||||
},
|
|
||||||
],
|
|
||||||
List_tosign : []
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
// 缓存取选择好的数据
|
// 缓存取选择好的数据\
|
||||||
this.tosign()
|
this.userinfo = uni.getStorageSync("userinfo")
|
||||||
|
|
||||||
|
this.tosign();
|
||||||
|
this.getLiveSpec();
|
||||||
|
|
||||||
|
this.device = uni.getSystemInfoSync(); // 获取信息
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
publish() {
|
||||||
|
let arr = this.imgarrB;
|
||||||
|
let newarr = [];
|
||||||
|
for (let index in arr) {
|
||||||
|
newarr.push(arr[index].file_id);
|
||||||
|
}
|
||||||
|
console.log(this.imgarrA,newarr);
|
||||||
|
this.$u.api
|
||||||
|
.publishphoto({
|
||||||
|
article_title: this.form.name,
|
||||||
|
article_content: this.form.intro,
|
||||||
|
article_pic: this.imgarrA[0].file_name,
|
||||||
|
file_id: newarr,
|
||||||
|
goods_id_arr: this.arres_list,
|
||||||
|
label_arr: this.selectarr
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
if (res.errCode != 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
setTimeout(function() {
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1
|
||||||
|
});
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 获取商品数组变化
|
||||||
|
getshoplist(id) {
|
||||||
|
let arr = this.arres_list;
|
||||||
|
let newarr = this.list;
|
||||||
|
this.shoplist = [];
|
||||||
|
for (let index in arr) {
|
||||||
|
for (let i in newarr) {
|
||||||
|
if (arr[index] == newarr[i].goods_id) {
|
||||||
|
this.shoplist.push(newarr[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(this.shoplist)
|
||||||
|
},
|
||||||
|
// 改变选中状态
|
||||||
|
changeselect(num) {
|
||||||
|
if (this.fileListes[num].state == true) {
|
||||||
|
this.fileListes[num].state = false;
|
||||||
|
let index = this.selectarr.indexOf(this.fileListes[num].id);
|
||||||
|
this.selectarr.splice(index, 1);
|
||||||
|
} else {
|
||||||
|
this.fileListes[num].state = true;
|
||||||
|
this.selectarr.push(this.fileListes[num].id);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 获取标签
|
||||||
|
getLiveSpec() {
|
||||||
|
let that = this;
|
||||||
|
this.$u.api.getLiveSpec({}).then(res => {
|
||||||
|
if (res.errCode != 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
let arr = res.data;
|
||||||
|
for (let index in arr) {
|
||||||
|
arr[index].state = false;
|
||||||
|
}
|
||||||
|
that.fileListes = arr;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 创建标签
|
||||||
|
addLiveSpec() {
|
||||||
|
this.$u.api
|
||||||
|
.createLivesp({
|
||||||
|
spec_name: this.tagcontent
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
if (res.errCode != 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.tagcontent = '';
|
||||||
|
this.show = false;
|
||||||
|
res.data.state = false;
|
||||||
|
this.fileListes.push(res.data);
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 删除标签
|
||||||
|
isTable(id,index) {
|
||||||
|
uni.showModal({
|
||||||
|
title: "提示",
|
||||||
|
content: "是否删除此标签?",
|
||||||
|
success: (res) => {
|
||||||
|
console.log();
|
||||||
|
if (res.confirm) {
|
||||||
|
this.delTable(id,index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
delTable(id,index) {
|
||||||
|
let me = this;
|
||||||
|
this.$u.post("Streaming/deltLabel", {label_id: id}).then(res => {
|
||||||
|
if (res.errCode == 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
this.fileListes.splice(index,1);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 上传封面
|
||||||
|
uploadcover(data) {
|
||||||
|
// console.log(data.data);
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
plus.io.getImageInfo({
|
||||||
|
src: data.data.file_path,
|
||||||
|
success: (res) => {
|
||||||
|
console.log(res);
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
if (data.errCode != 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: '上传失败',
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
let obj = data.data;
|
||||||
|
obj.url = obj.file_path;
|
||||||
|
this.imgarrA.push(obj);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 上传图片
|
||||||
|
uploadphoto(data) {
|
||||||
|
if (data.errCode != 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: '上传失败',
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
let obj = data.data;
|
||||||
|
obj.url = obj.file_path;
|
||||||
|
this.imgarrB.push(obj);
|
||||||
|
}
|
||||||
|
},
|
||||||
changes() {
|
changes() {
|
||||||
let that = this;
|
let that = this;
|
||||||
that.show_two = false;
|
that.show_two = false;
|
||||||
console.log(that.arres_list);
|
|
||||||
// 过滤数组
|
|
||||||
that.arres_list = [...new Set(that.arres_list)];
|
|
||||||
console.log(that.arres_list)
|
|
||||||
},
|
},
|
||||||
show_add() {
|
show_add() {
|
||||||
console.log(this.show)
|
this.show = !this.show;
|
||||||
this.show = !this.show
|
},
|
||||||
|
// 编辑标签
|
||||||
|
editing() {
|
||||||
|
this.is_edit = !this.is_edit;
|
||||||
},
|
},
|
||||||
// 选中某个复选框时,由checkbox时触发
|
// 选中某个复选框时,由checkbox时触发
|
||||||
checkboxChange(e) {
|
checkboxChange(e) {
|
||||||
console.log(e);
|
let that = this;
|
||||||
|
let num =Number(e.name)
|
||||||
if (e.value == true) {
|
if (e.value == true) {
|
||||||
let id = e.name;
|
that.pushes(that.list[num].goods_id);
|
||||||
this.pushes(id)
|
that.list[num].checked=true
|
||||||
|
} else {
|
||||||
|
that.delarr(that.list[num].goods_id);
|
||||||
|
that.list[num].checked=false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 删除直播商品
|
||||||
|
delarr(id) {
|
||||||
|
var that = this;
|
||||||
|
if (id == '') {
|
||||||
|
console.log('为空');
|
||||||
|
} else {
|
||||||
|
let index = that.arres_list.indexOf(id);
|
||||||
|
that.arres_list.splice(index, 1);
|
||||||
|
that.getshoplist();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 增加直播商品
|
||||||
pushes(id) {
|
pushes(id) {
|
||||||
var that = this;
|
var that = this;
|
||||||
console.log(id)
|
|
||||||
if (id == '') {
|
if (id == '') {
|
||||||
console.log("为空")
|
console.log('为空');
|
||||||
} else {
|
} else {
|
||||||
that.arres_list.push(id);
|
that.arres_list.push(id);
|
||||||
|
that.getshoplist();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 选中任一checkbox时,由checkbox-group触发
|
|
||||||
checkboxGroupChange(e) {
|
|
||||||
console.log(e);
|
|
||||||
|
|
||||||
},
|
|
||||||
tosign() {
|
tosign() {
|
||||||
console.log("111")
|
this.$u.api.canselectgood({}).then(res => {
|
||||||
this.$u.api.documentInfo({
|
if (res.data.live_stataes == 0) {
|
||||||
document_code: 'privacy'
|
this.$u.route({
|
||||||
}).then((res)=>{
|
url: `/pages/${url}`
|
||||||
console.log(res)
|
});
|
||||||
})
|
} else {
|
||||||
try {
|
let arr = res.data.list;
|
||||||
const value = uni.getStorageSync('list_tosign');
|
for (let index in arr) {
|
||||||
if (value) {
|
arr[index].checked = false;
|
||||||
console.log(value);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
this.list = arr;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// try {
|
||||||
|
// const value = uni.getStorageSync('list_tosign');
|
||||||
|
// if (value) {
|
||||||
|
// console.log(value);
|
||||||
|
// }
|
||||||
|
// } catch (e) {
|
||||||
|
// // error
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
#release {
|
#release {
|
||||||
width: 690rpx;
|
width: 690rpx;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
padding-bottom:20rpx;
|
||||||
.form-view {
|
.flex-title {
|
||||||
background: rgba(255, 120, 15, 1);
|
display: flex;
|
||||||
border-radius: 6rpx;
|
justify-content: space-between;
|
||||||
margin-right: 20rpx;
|
}
|
||||||
font-size: 24rpx;
|
.form-view {
|
||||||
padding: 8rpx 20rpx;
|
display: inline-block;
|
||||||
display: inline-block;
|
padding: 8rpx 20rpx;
|
||||||
margin-bottom: 28rpx;
|
margin-right: 20rpx;
|
||||||
color: #fff;
|
margin-bottom: 28rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #fff;
|
||||||
|
border-radius: 6rpx;
|
||||||
|
background-color: #cdc7c8;
|
||||||
|
.close {
|
||||||
|
margin-left: 10rpx;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.active {
|
||||||
|
background-color: #ff780f;
|
||||||
|
}
|
||||||
|
.scroll {
|
||||||
|
width: 100%;
|
||||||
|
height: 400px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.titles {
|
.titles {
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: rgba(51, 51, 51, 1);
|
color: rgba(51, 51, 51, 1);
|
||||||
margin: 30rpx 0;
|
margin: 30rpx 0;
|
||||||
|
>text{
|
||||||
|
font-size: 20rpx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
textarea {
|
textarea {
|
||||||
@@ -223,7 +450,7 @@
|
|||||||
|
|
||||||
.show_two .title {
|
.show_two .title {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-bottom: solid 1px #ECECEC;
|
border-bottom: solid 1px #ececec;
|
||||||
margin-bottom: 30rpx;
|
margin-bottom: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,14 +501,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.u-button {
|
.u-button {
|
||||||
background: #FF780F;
|
background: #ff780f;
|
||||||
width: 690rpx;
|
width: 690rpx;
|
||||||
height: 98rpx;
|
height: 98rpx;
|
||||||
line-height: 98rpx;
|
line-height: 98rpx;
|
||||||
background: rgba(255, 120, 15, 1);
|
background: rgba(255, 120, 15, 1);
|
||||||
border-radius: 49px;
|
border-radius: 49px;
|
||||||
font-size: 36rpx;
|
font-size: 36rpx;
|
||||||
color: #FFFFFF;
|
color: #ffffff;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin: 0 auto 20rpx;
|
margin: 0 auto 20rpx;
|
||||||
}
|
}
|
||||||
@@ -298,10 +525,32 @@
|
|||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.u-btn {
|
||||||
|
width: 628rpx;
|
||||||
|
height: 98rpx;
|
||||||
|
background: rgba(255, 120, 15, 1) !important;
|
||||||
|
border-radius: 49rpx;
|
||||||
|
margin: 0 auto;
|
||||||
|
font-size: 36rpx;
|
||||||
|
color: rgba(255, 255, 255, 1) !important;
|
||||||
|
line-height: 36px;
|
||||||
|
border: 1px #ff780f solid;
|
||||||
|
outline: none;
|
||||||
|
border-color: rgba(255, 120, 15, 1) !important;
|
||||||
|
}
|
||||||
|
.custom-style-button {
|
||||||
|
background: rgba(255, 120, 15, 1) !important;
|
||||||
|
color: #fff !important;
|
||||||
|
font-size: 28rpx;
|
||||||
|
width: 200rpx;
|
||||||
|
margin-bottom: 23rpx;
|
||||||
|
line-height: 60rpx;
|
||||||
|
height: 60rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.titles_border,
|
.titles_border,
|
||||||
.uni-textarea-compute {
|
.uni-textarea-compute {
|
||||||
border: 1px #BABABA solid !important;
|
border: 1px #bababa solid !important;
|
||||||
padding: 10rpx;
|
padding: 10rpx;
|
||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
<view class="title">我的商品</view>
|
<view class="title">我的商品</view>
|
||||||
<u-checkbox-group>
|
<u-checkbox-group>
|
||||||
<view class="list">
|
<view class="list">
|
||||||
<shopItem @xuanzhong="xuanzhong" class="items" v-for="(i,j) in list" :key="j" :image="i.goods_image" :title="i.goods_name" :price="i.goods_marketprice" :num="i.goods_salenum" :sid="i.goods_id" ref="shop"></shopItem>
|
<shopItem @xuanzhong="xuanzhong" :wxuanzhong="sele.indexOf(i.goods_id + '') > -1" class="items" v-for="(i,j) in list" :key="j" :image="i.goods_image" :title="i.goods_name" :price="i.goods_marketprice" :num="i.goods_salenum" :sid="i.goods_id" ref="shop"></shopItem>
|
||||||
</view>
|
</view>
|
||||||
</u-checkbox-group>
|
</u-checkbox-group>
|
||||||
<view class="jiaru" @click="jiaru">加入售货袋</view>
|
<view class="jiaru" @click="jiaru" :style="{'background-color': sele.length > 0 ? 'rgba(255, 120, 15, 1' : ''}">加入售货袋</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
@@ -45,6 +45,11 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(){
|
onLoad(){
|
||||||
|
this.sele = uni.getStorageSync("gouwudai").split(',')
|
||||||
|
if(this.sele[0] == ""){
|
||||||
|
this.sele = []
|
||||||
|
}
|
||||||
|
console.log(this.sele[0])
|
||||||
this.$u.api.getStoreGoodsList().then((res)=>{
|
this.$u.api.getStoreGoodsList().then((res)=>{
|
||||||
this.list = res.data.list
|
this.list = res.data.list
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,38 +1,39 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- tosign页面 -->
|
<!-- tosign页面 -->
|
||||||
<view>
|
<view>
|
||||||
<view class="tosign">
|
<view class="tosign" style="">
|
||||||
<image class="images" src="../../static/image/login/login(2).png"></image>
|
<image class="images" src="../../static/image/login/login(2).png"></image>
|
||||||
<view class="backes"></view>
|
<view class="backes"></view>
|
||||||
<!-- z自定义导航卡 -->
|
<!-- z自定义导航卡 -->
|
||||||
<u-navbar title="" class="content" :background="background" :is-back="false" :border-bottom="false">
|
<u-navbar title="" class="content" :background="background" :is-back="false" :border-bottom="false">
|
||||||
<!-- <image src="../../static/image/tosign/tosigin(4).png"></image> -->
|
<!-- <image src="../../static/image/tosign/tosigin(4).png"></image> -->
|
||||||
<image src="../../static/image/tosign/tosigin(1).png"></image>
|
<image src="../../static/image/tosign/tosigin(1).png" @click="fanhui"></image>
|
||||||
</u-navbar>
|
</u-navbar>
|
||||||
|
|
||||||
<view id="content_tosign">
|
<view id="content_tosign">
|
||||||
<u-form :model="form" ref="uForm">
|
<u-form :model="form" ref="uForm">
|
||||||
<u-form-item label-position="right">
|
<u-form-item label-position="right">
|
||||||
<u-input v-model="max" placeholder="优秀的标题可以卖的更好哦~" />
|
<u-input v-model="max" :placeholder="userinfo.role != 4 ? '优秀的标题可以卖的更好哦~' : '优秀的标题可以吸引更多人观看哦~'" />
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<view class="values"><text>{{this.titleMaxLength - this.max.length}}</text>/20</view>
|
<view class="values"><text>{{this.titleMaxLength - this.max.length}}</text>/20</view>
|
||||||
<u-form-item label-position="right">
|
<u-form-item label-position="right">
|
||||||
<u-input v-model="form.text" placeholder="请填写直播简介" />
|
<u-input v-model="form.text" placeholder="请填写直播简介" />
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<view class="values"><text>{{20 - form.text.length}}</text>/20</view>
|
<view class="values"><text>{{20 - form.text.length}}</text>/20</view>
|
||||||
<u-form-item label-position="right" >
|
<u-form-item label-position="right" v-if="userinfo.role != 4">
|
||||||
<u-input v-model="form.values" placeholder="我的售货袋" @click="navto('selectshop')"/>
|
<u-input :disabled="true" v-model="form.values" placeholder="我的售货袋" @click="navto('selectshop')"/>
|
||||||
<view class="rightes" @click="navto('selectshop')">售货袋</view>
|
<view class="rightes" @click="navto('selectshop')">售货袋</view>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
</u-form>
|
</u-form>
|
||||||
<!-- 标签的引入 -->
|
<!-- 标签的引入 -->
|
||||||
<tap_tosign :fileListes="fileListes" @chuangjian="chuangjian" @qiehuan="qiehuan"></tap_tosign>
|
<tap_tosign :fileListes="fileListes" @chuangjian="chuangjian" @qiehuan="qiehuan"></tap_tosign>
|
||||||
<view class="titles">直播封面图</view>
|
<view class="titles">直播封面图</view>
|
||||||
<u-upload :form-data="{'name':'article_cover'}" action='https://dmmall.sdbairui.com/storeapi/Upload/uploadFile' name="article_cover" :max-count="1" :show-progress="false" @on-change="tupian" del-color="#ececec" upload-text="上传" del-bg-color="#fff"></u-upload>
|
<u-upload ref="upload" :form-data="{'name':'article_cover'}" action='https://mall.dmygkeji.com/storeapi/Upload/uploadFile' name="article_cover" :header="{'Authorization' : 'Bearer' + ' ' + token}" :max-count="1" :show-progress="true" @on-change="tupian" @on-success="sccg" del-color="#ececec" upload-text="上传" del-bg-color="#fff" :before-upload="shangchuan"></u-upload>
|
||||||
</view>
|
</view>
|
||||||
<view class="button-uview">
|
<view class="button-uview">
|
||||||
<u-button @click="kaibo">{{relerest}}</u-button>
|
<u-button :hair-line="false" @click="kaibo">{{relerest}}</u-button>
|
||||||
</view>
|
</view>
|
||||||
|
<u-toast ref="uToast" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -60,10 +61,29 @@
|
|||||||
relerest: '开始直播',
|
relerest: '开始直播',
|
||||||
fileListes:[],
|
fileListes:[],
|
||||||
rSelect:[],
|
rSelect:[],
|
||||||
image:""
|
image:"",
|
||||||
|
token:"",
|
||||||
|
tiaozhuan:false,
|
||||||
|
userinfo:{}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
fanhui(){
|
||||||
|
this.$u.route({
|
||||||
|
type:"back",
|
||||||
|
delta:1
|
||||||
|
})
|
||||||
|
},
|
||||||
|
shangchuan(){
|
||||||
|
uni.showLoading({
|
||||||
|
title: '上传中',
|
||||||
|
mask:true
|
||||||
|
});
|
||||||
|
},
|
||||||
|
tupian(){
|
||||||
|
uni.hideLoading()
|
||||||
|
},
|
||||||
|
sccg() {},
|
||||||
// 选中某个复选框时,由checkbox时触发
|
// 选中某个复选框时,由checkbox时触发
|
||||||
checkboxChange(e) {
|
checkboxChange(e) {
|
||||||
//console.log(e);
|
//console.log(e);
|
||||||
@@ -90,8 +110,21 @@
|
|||||||
this.init()
|
this.init()
|
||||||
},
|
},
|
||||||
tupian(a){
|
tupian(a){
|
||||||
console.log(JSON.parse(a.data).data)
|
// console.log(JSON.parse(a.data));
|
||||||
this.image = JSON.parse(a.data).data.file_name
|
let info = JSON.parse(a.data);
|
||||||
|
console.log(info);
|
||||||
|
// console.log(JSON.stringify(a.data))
|
||||||
|
if(info.errCode == 1){
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: info.message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
this.$refs.upload.clear()
|
||||||
|
return ;
|
||||||
|
|
||||||
|
}
|
||||||
|
this.image = info.data.file_name;
|
||||||
|
|
||||||
},
|
},
|
||||||
navto(url){
|
navto(url){
|
||||||
this.$u.route({
|
this.$u.route({
|
||||||
@@ -99,6 +132,11 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
kaibo(){
|
kaibo(){
|
||||||
|
if(this.tiaozhuan){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
this.tiaozhuan = true
|
||||||
|
console.log(this.image)
|
||||||
this.$u.api.createChatRoom({
|
this.$u.api.createChatRoom({
|
||||||
chat_name:this.max,
|
chat_name:this.max,
|
||||||
live_desc:this.form.text,
|
live_desc:this.form.text,
|
||||||
@@ -106,14 +144,24 @@
|
|||||||
goods_id:uni.getStorageSync("gouwudai"),
|
goods_id:uni.getStorageSync("gouwudai"),
|
||||||
cover_img:this.image
|
cover_img:this.image
|
||||||
}).then((res)=>{
|
}).then((res)=>{
|
||||||
console.log(res)
|
console.log(JSON.stringify(res))
|
||||||
|
if(res.errCode == 1){
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
this.tiaozhuan = false
|
||||||
|
}
|
||||||
this.$u.route({
|
this.$u.route({
|
||||||
url:"/pages/release/zhibo",
|
url:"/pages/release/zhibo",
|
||||||
|
type:"redirectTo",
|
||||||
params:{
|
params:{
|
||||||
url:res.data.url.replace("&","*"),
|
url:res.data.url.replace("&","*"),
|
||||||
id:res.data.chat_id
|
id:res.data.chat_id,
|
||||||
|
live_id: res.data.live_id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
this.tiaozhuan = true
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
init(){
|
init(){
|
||||||
@@ -137,6 +185,16 @@
|
|||||||
onLoad(){
|
onLoad(){
|
||||||
this.init()
|
this.init()
|
||||||
uni.removeStorageSync('gouwudai')
|
uni.removeStorageSync('gouwudai')
|
||||||
|
//
|
||||||
|
|
||||||
|
this.token = uni.getStorageSync('token');
|
||||||
|
this.userinfo = uni.getStorageSync("userinfo")
|
||||||
|
console.log(this.userinfo)
|
||||||
|
var config = {
|
||||||
|
appkey: 'mgb7ka1',
|
||||||
|
debug:true
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@@ -467,10 +525,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.button-uview {
|
.button-uview {
|
||||||
position: fixed;
|
// position: fixed;
|
||||||
bottom: 40rpx;
|
// bottom: 40rpx;
|
||||||
left: 0;
|
// left: 0;
|
||||||
right: 0;
|
// right: 0;
|
||||||
margin: auto;
|
margin: 20rpx auto;
|
||||||
|
// z-index: 10;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,37 +1,168 @@
|
|||||||
<template>
|
<template>
|
||||||
<view id="release" >
|
<view id="release" >
|
||||||
<u-form :model="form" ref="uForm">
|
<u-form :model="form" ref="uForm">
|
||||||
<u-form-item label="标题" label-position="right">
|
<u-form-item label="标题" label-position="right"><u-input v-model="form.name" placeholder="请输入标题" /></u-form-item>
|
||||||
<u-input v-model="form.name" placeholder="请输入标题" />
|
<view class="titles">封面<text>(建议图片尺寸为334*334)</text></view>
|
||||||
</u-form-item>
|
<u-upload
|
||||||
<view class="titles">图片</view>
|
:form-data="coverformdata"
|
||||||
<u-upload :action="action" del-color="#ececec" upload-text="选择图片" del-bg-color="#fff" :file-list="fileList" ></u-upload>
|
:max-count="1"
|
||||||
|
:header="header"
|
||||||
|
name="article_cover"
|
||||||
|
:action="action"
|
||||||
|
del-color="#ececec"
|
||||||
|
upload-text="选择图片"
|
||||||
|
del-bg-color="#fff"
|
||||||
|
:file-list="fileListA"
|
||||||
|
@on-success="uploadcover"
|
||||||
|
></u-upload>
|
||||||
|
<view class="titles">视频<text>(建议视频时长在5分钟内,视频大小不超过100M)</text></view>
|
||||||
|
<view class="videobox video-flex" v-if="videostate == false" @click="uploadvideo">
|
||||||
|
<u-icon name="plus" class="u-add-btn" size="40"></u-icon>
|
||||||
|
<view class="videotext">选择视频</view>
|
||||||
|
</view>
|
||||||
|
<view class="videobox" v-else @click="uploadvideo">
|
||||||
|
<video v-if="!is_video" :src="videopath" controls></video>
|
||||||
|
<view v-else class="video-mode">
|
||||||
|
<image src="../../static/videoPlay.png" mode=""></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<!-- 标签 -->
|
<!-- 标签 -->
|
||||||
<view>
|
<view>
|
||||||
<view class="titles">标签</view>
|
<view class="titles flex-title">
|
||||||
<view class="form-view" @click="show_add()">+ 新建标签</view>
|
<text>标签</text>
|
||||||
<view class="form-view" v-for="(item,index) in fileListes" :key="index">{{item}}</view>
|
<text @click="editing">{{ is_edit ? "取消编辑" : "编辑" }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="form-view active" @click="show_add()">+ 新建标签</view>
|
||||||
|
<view :class="['form-view', item.state == true ? 'active' : '']" v-for="(item, index) in fileListes" :key="index" @click="changeselect(index)">
|
||||||
|
{{ item.name }}
|
||||||
|
<u-icon v-show="is_edit && item.user_id != 0" class="close" name="close" color="#666" size="18" @click="isTable(item.id,index)"></u-icon>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 简介 -->
|
<!-- 简介 -->
|
||||||
<view class="titles">正文</view>
|
<view class="titles">正文</view>
|
||||||
<textarea placeholder="请输入内容..."></textarea>
|
<view class="titles_border"><textarea placeholder="请输入内容..." v-model="form.intro"></textarea></view>
|
||||||
|
<view class="show_two">
|
||||||
|
<u-popup v-model="show_two" mode="bottom" @close="closeGood" :closeable="true">
|
||||||
|
<view class="title"><text>选择商品</text></view>
|
||||||
|
<!-- 商品列表 -->
|
||||||
|
<scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll">
|
||||||
|
<view class="listes_shoping" v-for="(item, index) in list" :key="index">
|
||||||
|
<view>
|
||||||
|
<u-checkbox-group>
|
||||||
|
<u-checkbox shape="circle" size="40" active-color="#FF780F" v-model="item.checked" :name="index" @change="checkboxChange"></u-checkbox>
|
||||||
|
</u-checkbox-group>
|
||||||
|
</view>
|
||||||
|
<view><image :src="item.goods_image" mode="widthFix"></image></view>
|
||||||
|
<view class="contentes">{{ item.goods_name }}</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
|
||||||
|
<!-- 提交按钮 -->
|
||||||
|
<view class="u-button" @click="changes()">确定</view>
|
||||||
|
</u-popup>
|
||||||
|
<!-- 底部选择商品列表 -->
|
||||||
|
<view @click="selectGoods" v-if="userinfo.role != 4">
|
||||||
|
选择商品
|
||||||
|
<image class="images" src="../../static/image/tosign/bhottom.png"></image>
|
||||||
|
</view>
|
||||||
|
<!-- 选择后的列表 -->
|
||||||
|
<view class="List_tosign" v-for="list in shoplist">
|
||||||
|
<view><image :src="list.goods_image" mode="scaleToFill"></image></view>
|
||||||
|
<view>{{ list.goods_name }}</view>
|
||||||
|
<view><image src="../../static/image/tosign/delete.png" mode="widthFix" @click="delarr(list.goods_id)"></image></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<!-- 提交 -->
|
<!-- 提交 -->
|
||||||
<u-button class="custom-style" shape="circle" size="default">发表</u-button>
|
<u-button class="custom-style" shape="circle" size="default" :hair-line="false" @click="publish">发表</u-button>
|
||||||
</u-form>
|
</u-form>
|
||||||
<!-- 添加标签的按钮 -->
|
<!-- 添加标签的按钮 -->
|
||||||
<u-popup v-model="show" mode="center" border-radius="14" :closeable="true">
|
<u-popup v-model="show" mode="center" border-radius="14" :closeable="true">
|
||||||
<view class="text">
|
<view class="text">创建属于你的标签吧</view>
|
||||||
创建属于你的标签吧
|
<view class="u-inputes"><u-input v-model="tagcontent" /></view>
|
||||||
</view>
|
<u-button :hair-line="false" class="custom-style-button" shape="circle" size="default" @click="addLiveSpec">确定</u-button>
|
||||||
<view class="u-inputes">
|
|
||||||
<u-input v-model="form.name" />
|
|
||||||
</view>
|
|
||||||
<u-button class="custom-style-button" shape="circle" size="default">确定</u-button>
|
|
||||||
</u-popup>
|
</u-popup>
|
||||||
|
<u-toast ref="uToast" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
let COS = require('../../common/cos-wx-sdk-v5.js');
|
||||||
|
// 上传文件
|
||||||
|
const upload_file_server = (_this, filepath) => {
|
||||||
|
// 腾讯云配置
|
||||||
|
let cosConfig = {
|
||||||
|
Bucket: 'dmmall-1302895943', //replace with yours
|
||||||
|
Region: 'ap-shanghai', //replace with yours
|
||||||
|
SecretId: 'AKID7z1lFeo0tV9YmmvZ52mrxlNmvqHTcuCF', //replace with yours
|
||||||
|
SecretKey: 'd3zTJ0RFwMYVE7jAMJzQ4UbS4YmmJiPq' //replace with yours
|
||||||
|
};
|
||||||
|
// 腾讯云配置
|
||||||
|
// let cosConfig = {
|
||||||
|
// Bucket: 'dmmall-1300406074', //replace with yours
|
||||||
|
// Region: 'ap-shanghai', //replace with yours
|
||||||
|
// SecretId: 'AKIDjDPJhni9gTzEB9iGNWQ3PTVGjv74q7EL', //replace with yours
|
||||||
|
// SecretKey: 'ye3SZOvAQO5X5LK3Vy933h6G86h4mqpG' //replace with yours
|
||||||
|
// };
|
||||||
|
// 获取本地文件
|
||||||
|
let filePath = filepath;
|
||||||
|
// 自定义文件名以及路径
|
||||||
|
let time = new Date();
|
||||||
|
var y = time.getFullYear();
|
||||||
|
var m = time.getMonth() + 1;
|
||||||
|
m = m < 10 ? '0' + m : m;
|
||||||
|
var d = time.getDate();
|
||||||
|
d = d < 10 ? '0' + d : d;
|
||||||
|
let str = y + m + d;
|
||||||
|
let Key = 'video/' + str + '/' + filePath.substr(filePath.lastIndexOf('/') + 1);
|
||||||
|
// 初始化凭证
|
||||||
|
var cos = new COS({
|
||||||
|
SecretId: cosConfig.SecretId,
|
||||||
|
SecretKey: cosConfig.SecretKey
|
||||||
|
});
|
||||||
|
//上传文件
|
||||||
|
cos.postObject(
|
||||||
|
{
|
||||||
|
Bucket: cosConfig.Bucket,
|
||||||
|
Region: cosConfig.Region,
|
||||||
|
Key: Key,
|
||||||
|
StorgeClass: 'STANDARD', //存储方式
|
||||||
|
FilePath: filePath
|
||||||
|
},
|
||||||
|
(err, data) => {
|
||||||
|
console.log(err, data, 12345);
|
||||||
|
if (err == null) {
|
||||||
|
if (data.statusCode == 200) {
|
||||||
|
_this.videopath = 'https://dmmall-1302895943.cos.ap-shanghai.myqcloud.com/' + Key;
|
||||||
|
uni.hideLoading();
|
||||||
|
_this.videostate = true;
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '上传失败!',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
// 选择图片(通用)
|
||||||
|
const cImage = _this => {
|
||||||
|
uni.chooseVideo({
|
||||||
|
count: 1,
|
||||||
|
sourceType: ['camera', 'album'],
|
||||||
|
success: function(res) {
|
||||||
|
// _this.is_video = true;
|
||||||
|
uni.showLoading({
|
||||||
|
title: '上传中'
|
||||||
|
});
|
||||||
|
const tempFilePaths = res.tempFilePath;
|
||||||
|
console.log(tempFilePaths);
|
||||||
|
upload_file_server(_this, tempFilePaths);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -40,30 +171,415 @@
|
|||||||
intro: '',
|
intro: '',
|
||||||
sex: ''
|
sex: ''
|
||||||
},
|
},
|
||||||
|
coverformdata: {
|
||||||
|
name: 'article_cover'
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
Authorization: 'Bearer' + ' ' + uni.getStorageSync('token')
|
||||||
|
},
|
||||||
// 演示地址,请勿直接使用
|
// 演示地址,请勿直接使用
|
||||||
action: 'http://www.example.com/upload',
|
action: 'https://mall.dmygkeji.com/storeapi/Upload/uploadFile',
|
||||||
fileList: [],
|
fileListA: [],
|
||||||
fileListes:["美妆","博主穿搭","美妆","美妆","美妆","美妆","美妆","博主穿搭"],
|
imgarrA: [],
|
||||||
show: false
|
videopath: '', //视频链接
|
||||||
|
fileListes: [],
|
||||||
|
show: false,
|
||||||
|
is_video: false,
|
||||||
|
show_two: false,
|
||||||
|
arres_list: [],
|
||||||
|
shoplist: [], //选择商品列表
|
||||||
|
list: [],
|
||||||
|
scrollTop: 0,
|
||||||
|
selectarr: [], //选中标签
|
||||||
|
tagcontent: '', //新建标签名字
|
||||||
|
selectvideo: '', //视频名字
|
||||||
|
videostate: false, //视频状态
|
||||||
|
progress: 0,
|
||||||
|
is_edit: false, // 编辑标签
|
||||||
|
userinfo:{}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
this.userinfo = uni.getStorageSync("userinfo")
|
||||||
|
this.getLiveSpec();
|
||||||
|
this.resetgood();
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
show() {
|
||||||
|
let me = this;
|
||||||
|
if (this.show) {
|
||||||
|
this.is_video = true;
|
||||||
|
} else {
|
||||||
|
setTimeout(function() {
|
||||||
|
me.is_video = false;
|
||||||
|
},600)
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
immediate: true
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
show_add(){
|
// 获取可以推荐的商品
|
||||||
console.log(this.show)
|
resetgood() {
|
||||||
this.show = !this.show
|
this.$u.api.canselectgood({}).then(res => {
|
||||||
|
if (res.data.live_stataes == 0) {
|
||||||
|
this.$u.route({
|
||||||
|
url: `/pages/${url}`
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
let arr = res.data.list;
|
||||||
|
for (let index in arr) {
|
||||||
|
arr[index].checked = false;
|
||||||
|
}
|
||||||
|
this.list = arr;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 发布短视频
|
||||||
|
publish() {
|
||||||
|
this.$u.api.publishvideo({
|
||||||
|
article_title: this.form.name,
|
||||||
|
article_content: this.form.intro,
|
||||||
|
article_pic: this.imgarrA[0].file_name,
|
||||||
|
video_path: this.videopath,
|
||||||
|
goods_id_arr: this.arres_list,
|
||||||
|
label_arr: this.selectarr
|
||||||
|
}).then(res => {
|
||||||
|
if (res.errCode != 0) {
|
||||||
|
// this.$refs.uToast.show({
|
||||||
|
// title: res.message,
|
||||||
|
// type: 'error'
|
||||||
|
// });
|
||||||
|
uni.showToast({
|
||||||
|
title: res.message,
|
||||||
|
icon: "none"
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
// this.$refs.uToast.show({
|
||||||
|
// title: res.message,
|
||||||
|
// type: 'success'
|
||||||
|
// });
|
||||||
|
uni.showToast({
|
||||||
|
title: res.message,
|
||||||
|
icon: "none"
|
||||||
|
})
|
||||||
|
setTimeout(function() {
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1
|
||||||
|
});
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 获取商品数组变化
|
||||||
|
getshoplist() {
|
||||||
|
let arr = this.arres_list;
|
||||||
|
let newarr = this.list;
|
||||||
|
this.shoplist = [];
|
||||||
|
for (let index in arr) {
|
||||||
|
for (let i in newarr) {
|
||||||
|
if (arr[index] == newarr[i].goods_id) {
|
||||||
|
this.shoplist.push(newarr[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
// 改变选中状态
|
||||||
|
changeselect(num) {
|
||||||
|
if (this.fileListes[num].state == true) {
|
||||||
|
this.fileListes[num].state = false;
|
||||||
|
let index = this.selectarr.indexOf(this.fileListes[num].id);
|
||||||
|
this.selectarr.splice(index, 1);
|
||||||
|
} else {
|
||||||
|
this.fileListes[num].state = true;
|
||||||
|
this.selectarr.push(this.fileListes[num].id);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 选择商品
|
||||||
|
selectGoods() {
|
||||||
|
this.show_two = true;
|
||||||
|
this.is_video = true;
|
||||||
|
},
|
||||||
|
// 选择商品弹窗关闭
|
||||||
|
closeGood() {
|
||||||
|
this.is_video = false;
|
||||||
|
},
|
||||||
|
// 创建标签
|
||||||
|
addLiveSpec() {
|
||||||
|
this.$u.api.createLivesp({
|
||||||
|
spec_name: this.tagcontent
|
||||||
|
}).then(res => {
|
||||||
|
if (res.errCode != 0) {
|
||||||
|
// this.$refs.uToast.show({
|
||||||
|
// title: res.message,
|
||||||
|
// type: 'error',
|
||||||
|
// });
|
||||||
|
uni.showToast({
|
||||||
|
title: res.message,
|
||||||
|
icon: "none"
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.tagcontent = '';
|
||||||
|
this.show = false;
|
||||||
|
res.data.state = false;
|
||||||
|
this.fileListes.push(res.data);
|
||||||
|
// this.$refs.uToast.show({
|
||||||
|
// title: res.message,
|
||||||
|
// type: 'success'
|
||||||
|
// });
|
||||||
|
uni.showToast({
|
||||||
|
title: res.message,
|
||||||
|
icon: "none"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 获取标签
|
||||||
|
getLiveSpec() {
|
||||||
|
let that = this;
|
||||||
|
this.$u.api.getLiveSpec({}).then(res => {
|
||||||
|
if (res.errCode != 0) {
|
||||||
|
// this.$refs.uToast.show({
|
||||||
|
// title: res.message,
|
||||||
|
// type: 'error'
|
||||||
|
// });
|
||||||
|
uni.showToast({
|
||||||
|
title: res.message,
|
||||||
|
icon: "none"
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
let arr = res.data;
|
||||||
|
for (let index in arr) {
|
||||||
|
arr[index].state = false;
|
||||||
|
}
|
||||||
|
that.fileListes = arr;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 删除标签
|
||||||
|
isTable(id,index) {
|
||||||
|
uni.showModal({
|
||||||
|
title: "提示",
|
||||||
|
content: "是否删除此标签?",
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
this.delTable(id,index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
delTable(id,index) {
|
||||||
|
let me = this;
|
||||||
|
this.$u.post("Streaming/deltLabel", {label_id: id}).then(res => {
|
||||||
|
if (res.errCode == 0) {
|
||||||
|
// this.$refs.uToast.show({
|
||||||
|
// title: res.message,
|
||||||
|
// type: 'success'
|
||||||
|
// });
|
||||||
|
uni.showToast({
|
||||||
|
title: res.message,
|
||||||
|
icon: "none"
|
||||||
|
})
|
||||||
|
this.fileListes.splice(index,1);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 上传封面
|
||||||
|
uploadcover(data) {
|
||||||
|
let obj = data.data;
|
||||||
|
obj.url = obj.file_path;
|
||||||
|
this.imgarrA.push(obj);
|
||||||
|
},
|
||||||
|
// 上传视频
|
||||||
|
uploadvideo() {
|
||||||
|
cImage(this);
|
||||||
|
},
|
||||||
|
// 新建标签
|
||||||
|
show_add() {
|
||||||
|
this.show = !this.show;
|
||||||
|
},
|
||||||
|
// 编辑标签
|
||||||
|
editing() {
|
||||||
|
this.is_edit = !this.is_edit;
|
||||||
|
},
|
||||||
|
// 选择直播商品点击确定
|
||||||
|
changes() {
|
||||||
|
let that = this;
|
||||||
|
that.show_two = false;
|
||||||
|
},
|
||||||
|
// 选中某个复选框时,由checkbox时触发
|
||||||
|
checkboxChange(e) {
|
||||||
|
let that = this;
|
||||||
|
let num = Number(e.name);
|
||||||
|
if (e.value == true) {
|
||||||
|
that.pushes(that.list[num].goods_id);
|
||||||
|
that.list[num].checked = true;
|
||||||
|
} else {
|
||||||
|
that.delarr(that.list[num].goods_id);
|
||||||
|
that.list[num].checked = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 删除直播商品
|
||||||
|
delarr(id) {
|
||||||
|
var that = this;
|
||||||
|
if (id == '') {
|
||||||
|
console.log('为空');
|
||||||
|
} else {
|
||||||
|
let index = that.arres_list.indexOf(id);
|
||||||
|
that.arres_list.splice(index, 1);
|
||||||
|
that.getshoplist();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 增加直播商品
|
||||||
|
pushes(id) {
|
||||||
|
var that = this;
|
||||||
|
if (id == '') {
|
||||||
|
console.log('为空');
|
||||||
|
} else {
|
||||||
|
that.arres_list.push(id);
|
||||||
|
that.getshoplist();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: {}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
#release {
|
#release {
|
||||||
width: 690rpx;
|
width: 690rpx;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
.form-view{
|
padding-bottom:20rpx;
|
||||||
|
.flex-title {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
.titles_border,
|
||||||
|
.uni-textarea-compute {
|
||||||
|
border: 1px #bababa solid !important;
|
||||||
|
padding: 10rpx;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
}
|
||||||
|
.show_two {
|
||||||
|
padding: 30rpx 0 70rpx 0;
|
||||||
|
}
|
||||||
|
.scroll {
|
||||||
|
width: 100%;
|
||||||
|
height: 400px;
|
||||||
|
}
|
||||||
|
.u-button {
|
||||||
|
background: #ff780f;
|
||||||
|
width: 690rpx;
|
||||||
|
height: 98rpx;
|
||||||
|
line-height: 98rpx;
|
||||||
background: rgba(255, 120, 15, 1);
|
background: rgba(255, 120, 15, 1);
|
||||||
|
border-radius: 49px;
|
||||||
|
font-size: 36rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
text-align: center;
|
||||||
|
margin: 0 auto 20rpx;
|
||||||
|
}
|
||||||
|
.show_two .title {
|
||||||
|
width: 100%;
|
||||||
|
border-bottom: solid 1px #ececec;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.show_two .title > text {
|
||||||
|
font-size: 30rpx;
|
||||||
|
padding: 30rpx;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.show_two > view {
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: 400;
|
||||||
|
color: rgba(51, 51, 51, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.show_two .images {
|
||||||
|
width: 22rpx;
|
||||||
|
height: 12rpx;
|
||||||
|
float: right;
|
||||||
|
top: 14rpx;
|
||||||
|
}
|
||||||
|
.List_tosign {
|
||||||
|
overflow: hidden;
|
||||||
|
zoom: 1;
|
||||||
|
margin-top: 21rpx;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.List_tosign > view {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.List_tosign > view:nth-child(1) {
|
||||||
|
width: 180rpx;
|
||||||
|
height: 160rpx;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
image {
|
||||||
|
border-radius: 15rpx;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.List_tosign > view:nth-child(2) {
|
||||||
|
width: 420rpx;
|
||||||
|
height: 76rpx;
|
||||||
|
margin: 43rpx 43rpx 0 21rpx;
|
||||||
|
}
|
||||||
|
.List_tosign > view:nth-child(3) {
|
||||||
|
width: 26rpx;
|
||||||
|
height: 27rpx;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
margin: auto;
|
||||||
|
image {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.listes_shoping {
|
||||||
|
overflow: hidden;
|
||||||
|
zoom: 1;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
height: 160rpx;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.listes_shoping > view {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.listes_shoping > view:nth-child(1) {
|
||||||
|
width: 36rpx;
|
||||||
|
height: 36rpx;
|
||||||
|
margin-top: 62rpx;
|
||||||
|
margin-left: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.listes_shoping > view:nth-child(2) {
|
||||||
|
width: 180rpx;
|
||||||
|
height: 160rpx;
|
||||||
|
margin: 0 31rpx 0 19rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.listes_shoping > view:nth-child(2) image {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.listes_shoping > view:nth-child(3) {
|
||||||
|
width: 425rpx;
|
||||||
|
margin-top: 43rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
-webkit-line-clamp: 2;
|
||||||
|
}
|
||||||
|
.form-view {
|
||||||
|
background: #cdc7c8;
|
||||||
border-radius: 6rpx;
|
border-radius: 6rpx;
|
||||||
margin-right: 20rpx;
|
margin-right: 20rpx;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
@@ -71,12 +587,58 @@
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-bottom: 28rpx;
|
margin-bottom: 28rpx;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
.close {
|
||||||
|
margin-left: 10rpx;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.active {
|
||||||
|
background: #ff780f;
|
||||||
}
|
}
|
||||||
.titles {
|
.titles {
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: rgba(51, 51, 51, 1);
|
color: rgba(51, 51, 51, 1);
|
||||||
margin: 30rpx 0;
|
margin: 30rpx 0;
|
||||||
|
>text{
|
||||||
|
font-size: 20rpx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.video-flex {
|
||||||
|
flex-direction: column;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.videobox {
|
||||||
|
width: 200rpx;
|
||||||
|
height: 200rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
background-color: #f4f5f6;
|
||||||
|
margin-left: 10rpx;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
|
||||||
|
.video-mode {
|
||||||
|
width: 200rpx;
|
||||||
|
height: 200rpx;
|
||||||
|
line-height: 280rpx;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
background-color: #000;
|
||||||
|
& > image {
|
||||||
|
width: 100rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.videotext {
|
||||||
|
margin-top: 10rpx;
|
||||||
|
}
|
||||||
|
.videobox video {
|
||||||
|
width: 200rpx;
|
||||||
|
height: 200rpx;
|
||||||
}
|
}
|
||||||
textarea {
|
textarea {
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
@@ -84,7 +646,20 @@
|
|||||||
.custom-style {
|
.custom-style {
|
||||||
background: rgba(255, 120, 15, 1) !important;
|
background: rgba(255, 120, 15, 1) !important;
|
||||||
color: #fff !important;
|
color: #fff !important;
|
||||||
|
// font-size: 36rpx;
|
||||||
|
}
|
||||||
|
.u-btn {
|
||||||
|
width: 628rpx;
|
||||||
|
height: 98rpx;
|
||||||
|
background: rgba(255, 120, 15, 1) !important;
|
||||||
|
border-radius: 49rpx;
|
||||||
|
margin: 0 auto;
|
||||||
font-size: 36rpx;
|
font-size: 36rpx;
|
||||||
|
color: rgba(255, 255, 255, 1) !important;
|
||||||
|
line-height: 36px;
|
||||||
|
border: 1px #ff780f solid;
|
||||||
|
outline: none;
|
||||||
|
border-color: rgba(255, 120, 15, 1) !important;
|
||||||
}
|
}
|
||||||
.custom-style-button {
|
.custom-style-button {
|
||||||
background: rgba(255, 120, 15, 1) !important;
|
background: rgba(255, 120, 15, 1) !important;
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<live-pusher id='livePusher' ref="livePusher" class="livePusher" :url="url"
|
<live-pusher id='livePusher' ref="livePusher" class="livePusher" :url="url"
|
||||||
mode="SD" :muted="true" :enable-camera="true" :auto-focus="true" :beauty="1" whiteness="2"
|
mode="FHD" :muted="false" :enable-camera="true" :auto-focus="true" :beauty="meiyan + 1" whiteness="0"
|
||||||
aspect="9:16" @statechange="statechange" @netstatus="netstatus" @error = "error"
|
aspect="9:16" @statechange="statechange" @netstatus="netstatus" @error = "error"
|
||||||
:style="{'height':height + 'px'}"
|
:style="{'height':height + 'px'}"
|
||||||
></live-pusher>
|
></live-pusher>
|
||||||
<div class="bottom" :style="{'height':height + 'px'}" v-if="show" @click="show = false">
|
<div class="bottom" :style="{'height':height }" v-if="show" @click="show = false">
|
||||||
<div class="tanchuceng" @click="zuzhi">
|
<div class="tanchuceng" @click="zuzhi">
|
||||||
<div class="head">
|
<div class="head">
|
||||||
<div style="flex-direction: row;align-items:center">
|
<div style="flex-direction: row;align-items:center">
|
||||||
<text class="title">全部商品</text>
|
<text class="title">全部商品</text>
|
||||||
<text class="num">2件</text>
|
<text class="num">{{list.length}}件</text>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="add">
|
<!-- <div class="add">
|
||||||
<text style="font-size:28rpx;color: #fff;text-align:center">添加/管理商品</text>
|
<text style="font-size:28rpx;color: #fff;text-align:center">添加/管理商品</text>
|
||||||
@@ -35,13 +35,66 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="user">
|
<div v-if="zhibo" class="user">
|
||||||
</div>
|
</div>
|
||||||
<div style="position: fixed;top: 60rpx;left: 30rpx;flex-direction: row;align-items:center">
|
<div v-if="zhibo" style="position: fixed;top: 60rpx;left: 30rpx;flex-direction: row;align-items:center">
|
||||||
<image class="userhead" :src="info.member_avatar"></image>
|
<image class="userhead" :src="info.member_avatar"></image>
|
||||||
<div class="userinfo">
|
<div class="userinfo">
|
||||||
<text class="username">{{info.member_name}}</text>
|
<text class="username">{{info.member_nickname}}</text>
|
||||||
<text class="username" style="font-size:20rpx">asdasdsa | sadasdas</text>
|
<text class="username" style="font-size:20rpx">{{time}} | {{room.onlineUsers.users.length - 1 < 0 ? 0 : room.onlineUsers.users.length - 1}}</text>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<image v-if="zhibo" class="closeimg" src="../../static/image/close.png" @click="closes"></image>
|
||||||
|
<image v-if="zhibo" class="menuimg" src="../../static/image/menu.png" @click="tool = true"></image>
|
||||||
|
<image v-if="zhibo && list.length != 0" class="shoptapimg" @click="xianshi" src="../../static/image/shop.png" ></image>
|
||||||
|
<text v-if="zhibo && fen" style="font-size:26rpx;color:#fff;width:512rpx;position:fixed;left:30rpx;top:793rpx;">本平台提倡绿色健康直播,严禁在平台内外出现诱导未成年人诈骗、赌博、低俗色情、吸烟酗酒等不当行为,若有违反,将向相关部门依法追究您的法律责任。如因此给平台造成损失,有权向您全额追偿。
|
||||||
|
</text>
|
||||||
|
<div v-if="zhibo" class="danmulist">
|
||||||
|
<text class="danmuitem" v-for="(i,j) in danmulist" :key="j">{{i.senderNickname}}:{{i.content}}</text>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="bottom" :style="{'height':height + 'px'}" v-if="tool" @click="tool = false">
|
||||||
|
<view class="menu" @click="zuzhi">
|
||||||
|
<view class="menuback"></view>
|
||||||
|
<text class="menutitle">直播工具</text>
|
||||||
|
<view class="menutool">
|
||||||
|
<view class="menutoolitem" @click="switchCamera">
|
||||||
|
<image src="../../static/images/fanzhuan.png" class="menutoolitemimg"></image>
|
||||||
|
<text class="menutoolitemtitle">翻转</text>
|
||||||
|
</view>
|
||||||
|
<picker @change="bindPickerChange" :value="meiyan" :range="[1,2,3,4,5,6,7,8,9]">
|
||||||
|
<view class="menutoolitem">
|
||||||
|
<image src="../../static/images/meiyan.png" class="menutoolitemimg"></image>
|
||||||
|
<text class="menutoolitemtitle">美颜</text>
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</div>
|
||||||
|
<div class="jieshu" v-if="!zhibo" :style="{'height':height + 'px'}">
|
||||||
|
<div class="jieshuback" :style="{'height':height + 'px'}" @click="closes1"></div>
|
||||||
|
<image class="closeimg" src="../../static/image/cloneb.png" @click="closes"></image>
|
||||||
|
<text class="jieshutitle">徳铭阳光在线</text>
|
||||||
|
<image class="jieshuheadimg" @click="closes1" :src="info.member_avatar"></image>
|
||||||
|
<text class="jieshuusername">{{info.member_nickname}}</text>
|
||||||
|
<div class="jieshubox">
|
||||||
|
<view class="jieshuboxitem">
|
||||||
|
<text style="color:#fff;font-size:30rpx">{{jieshu.newfans}}</text>
|
||||||
|
<text style="color:#fff;font-size:30rpx;margin-top:10rpx">新粉丝</text>
|
||||||
|
</view>
|
||||||
|
<view class="jieshuboxitem">
|
||||||
|
<text style="color:#fff;font-size:30rpx">{{jieshu.headcount}}</text>
|
||||||
|
<text style="color:#fff;font-size:30rpx;margin-top:10rpx">观看人数</text>
|
||||||
|
</view>
|
||||||
|
<view class="jieshuboxitem" v-if="list.length != 0">
|
||||||
|
<text style="color:#fff;font-size:30rpx">RMB {{jieshu.sales_amount}}</text>
|
||||||
|
<text style="color:#fff;font-size:30rpx;margin-top:10rpx">直播销量</text>
|
||||||
|
</view>
|
||||||
|
<view class="jieshuboxitem" v-if="list.length != 0">
|
||||||
|
<text style="color:#fff;font-size:30rpx">{{jieshu.buy_num}}</text>
|
||||||
|
<text style="color:#fff;font-size:30rpx;margin-top:10rpx">购买人数</text>
|
||||||
|
</view>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <button class="btn" @click="start">开始推流1</button>
|
<!-- <button class="btn" @click="start">开始推流1</button>
|
||||||
@@ -56,6 +109,81 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.jieshuboxitem{
|
||||||
|
width: 210rpx;
|
||||||
|
height: 120rpx;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.jieshubox{
|
||||||
|
width: 438rpx;
|
||||||
|
height: 288rpx;
|
||||||
|
border-width: 1rpx;
|
||||||
|
border-color: #fff;
|
||||||
|
margin-top: 78rpx;
|
||||||
|
flex-direction: row;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
|
||||||
|
}
|
||||||
|
.jieshuusername{
|
||||||
|
font-size: 30rpx;
|
||||||
|
margin-top: 31rpx;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.jieshuheadimg{
|
||||||
|
width: 154rpx;
|
||||||
|
height: 154rpx;
|
||||||
|
border-radius: 77rpx;
|
||||||
|
}
|
||||||
|
.jieshutitle{
|
||||||
|
font-size: 30rpx;
|
||||||
|
color:#fff;
|
||||||
|
width: 350rpx;
|
||||||
|
position: absolute;
|
||||||
|
top: 70rpx;
|
||||||
|
left: 31rpx;
|
||||||
|
height: 31rpx;
|
||||||
|
}
|
||||||
|
.jieshuback{
|
||||||
|
background-color: #000;
|
||||||
|
opacity: 0.8;
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 750rpx;
|
||||||
|
}
|
||||||
|
.jieshu{
|
||||||
|
z-index: 9999;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 750rpx;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.shoptapimg{
|
||||||
|
width: 65rpx;
|
||||||
|
height: 65rpx;
|
||||||
|
position: fixed;
|
||||||
|
right: 26rpx;
|
||||||
|
bottom: 24rpx;
|
||||||
|
}
|
||||||
|
.menuimg{
|
||||||
|
width: 60rpx;
|
||||||
|
height: 55rpx;
|
||||||
|
position: fixed;
|
||||||
|
left: 26rpx;
|
||||||
|
bottom: 24rpx;
|
||||||
|
}
|
||||||
|
.closeimg{
|
||||||
|
position: absolute;
|
||||||
|
top: 70rpx;
|
||||||
|
right: 31rpx;
|
||||||
|
width: 51rpx;
|
||||||
|
height: 51rpx;
|
||||||
|
padding:10rpx;
|
||||||
|
z-index:99999;
|
||||||
|
}
|
||||||
.username{
|
.username{
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
@@ -97,7 +225,6 @@
|
|||||||
.shopimg{
|
.shopimg{
|
||||||
width: 160rpx;
|
width: 160rpx;
|
||||||
height: 160rpx;
|
height: 160rpx;
|
||||||
background-color: #0f0;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -107,7 +234,9 @@
|
|||||||
border-bottom-width: 2rpx;
|
border-bottom-width: 2rpx;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-color: #ECECEC;
|
border-color: #ECECEC;
|
||||||
|
/* #ifndef APP-PLUS-NVUE */
|
||||||
display: flex;
|
display: flex;
|
||||||
|
/* #endif */
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
@@ -142,7 +271,9 @@
|
|||||||
border-bottom-width: 2rpx;
|
border-bottom-width: 2rpx;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-color: #ECECEC;
|
border-color: #ECECEC;
|
||||||
|
/* #ifndef APP-PLUS-NVUE */
|
||||||
display: flex;
|
display: flex;
|
||||||
|
/* #endif */
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@@ -164,41 +295,181 @@
|
|||||||
z-index: 20;
|
z-index: 20;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
.menu{
|
||||||
|
width: 750rpx;
|
||||||
|
height: 335rpx;
|
||||||
|
border-top-left-radius: 20rpx;
|
||||||
|
border-top-right-radius: 20rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
.menuback{
|
||||||
|
background-color: #000;
|
||||||
|
opacity: 0.8;
|
||||||
|
position: absolute;
|
||||||
|
border-top-left-radius: 20rpx;
|
||||||
|
border-top-right-radius: 20rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 750rpx;
|
||||||
|
height: 335rpx;
|
||||||
|
}
|
||||||
|
.menutitle{
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: #fff;
|
||||||
|
margin-left: 30rpx;
|
||||||
|
margin-top: 30rpx;
|
||||||
|
}
|
||||||
|
.menutool{
|
||||||
|
flex-direction: row;
|
||||||
|
margin-top: 59rpx;
|
||||||
|
margin-left: 30rpx;
|
||||||
|
}
|
||||||
|
.menutoolitem{
|
||||||
|
align-items: center;
|
||||||
|
margin-right: 60rpx;
|
||||||
|
}
|
||||||
|
.menutoolitemtitle{
|
||||||
|
margin-top: 30rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.menutoolitemimg{
|
||||||
|
width: 100rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
}
|
||||||
|
.danmulist{
|
||||||
|
position: fixed;
|
||||||
|
left: 30rpx;
|
||||||
|
bottom: 118rpx;
|
||||||
|
width: 690rpx;
|
||||||
|
}
|
||||||
|
.danmuitem{
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: #fff;
|
||||||
|
flex-direction: column-reverse;
|
||||||
|
/* #ifndef APP-PLUS-NVUE */
|
||||||
|
word-wrap:anywhere;
|
||||||
|
/* #endif */
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.livePusher{
|
||||||
|
width: 750rpx;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
const RongIMLib = require('../../static/rongyun.js');
|
const ChatRoomService =require('../../static/chatservice');
|
||||||
export default {
|
export default {
|
||||||
data: {
|
data: {
|
||||||
fil: true,
|
fil: true,
|
||||||
url:'',
|
url:'',
|
||||||
height:0,
|
height:0,
|
||||||
show:true,
|
show:false,
|
||||||
list:[],
|
list:[],
|
||||||
info:{},
|
info:{},
|
||||||
im:{}
|
im:{},
|
||||||
|
chatroom_id:0,
|
||||||
|
live_id:0,
|
||||||
|
tool:false,
|
||||||
|
meiyan:0,
|
||||||
|
time:'00:00:00',
|
||||||
|
room:{},
|
||||||
|
chatRoomService:{},
|
||||||
|
danmulist:[],
|
||||||
|
zhibo:true,
|
||||||
|
jieshu:{},
|
||||||
|
renshumax:0,
|
||||||
|
changeLiveRealtimeNumber:{},
|
||||||
|
fen:true
|
||||||
|
},
|
||||||
|
onLaunch: function() {
|
||||||
|
console.log('App Launch');
|
||||||
|
},
|
||||||
|
onShow: function() {
|
||||||
|
if(!this.zhibo){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
this.stop()
|
||||||
|
this.startPreview()
|
||||||
|
this.start()
|
||||||
|
// var message = {
|
||||||
|
// senderNickname : this.room.currentUser.nickname ,
|
||||||
|
// type : 1,
|
||||||
|
// content : '重连'
|
||||||
|
// }
|
||||||
|
// this.chatRoomService.sendMessages(this.room.id, message);
|
||||||
|
},
|
||||||
|
onHide: function() {
|
||||||
|
console.log('App Hide');
|
||||||
|
this.chatRoomService.warrings = ()=>{};
|
||||||
|
},
|
||||||
|
//模拟onshow生命周期
|
||||||
|
created() {
|
||||||
|
//监听当前窗口显示
|
||||||
|
currentWebview.addEventListener('show',e=>{
|
||||||
|
console.log('search show');
|
||||||
|
this.startPreview()
|
||||||
|
this.start()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
//摧毁之前的声明周期
|
||||||
|
beforeDestroy() {
|
||||||
|
//移除监听事件
|
||||||
|
console.log(123)
|
||||||
|
currentWebview.removeEventListener('show',e=>{})
|
||||||
},
|
},
|
||||||
onReady() {
|
onReady() {
|
||||||
// 注意:需要在onReady中 或 onLoad 延时
|
// 注意:需要在onReady中 或 onLoad 延时
|
||||||
this.context = uni.createLivePusherContext("livePusher", this);
|
|
||||||
this.startPreview()
|
|
||||||
let that = this
|
let that = this
|
||||||
|
setTimeout(()=>{
|
||||||
uni.getSystemInfo({
|
uni.getSystemInfo({
|
||||||
success(a){
|
success(a){
|
||||||
console.log(a.windowHeight)
|
console.log(a.windowHeight,1212)
|
||||||
that.height = a.windowHeight
|
that.height = a.windowHeight
|
||||||
// that.start()
|
// that.start()
|
||||||
|
setTimeout(()=>{
|
||||||
|
that.context = uni.createLivePusherContext("livePusher", that);
|
||||||
|
that.startPreview()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
},500)
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
},500)
|
||||||
|
|
||||||
|
},
|
||||||
|
onBackPress(options) {
|
||||||
|
if (options.from === 'navigateBack' || !this.zhibo) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
this.closes();
|
||||||
|
return true;
|
||||||
},
|
},
|
||||||
onLoad(a){
|
onLoad(a){
|
||||||
|
|
||||||
|
console.log(getApp().globalData.im)
|
||||||
|
uni.setKeepScreenOn({
|
||||||
|
keepScreenOn: true
|
||||||
|
});
|
||||||
this.url = a.url.replace("*","&")
|
this.url = a.url.replace("*","&")
|
||||||
let that = this
|
let that = this
|
||||||
const token = uni.getStorageSync('token');
|
const token = uni.getStorageSync('token');
|
||||||
|
console.log('Bearer' + " " + token)
|
||||||
|
this.chatroom_id = a.id
|
||||||
|
this.live_id = a.live_id
|
||||||
|
|
||||||
uni.request({
|
uni.request({
|
||||||
url:"https://dmmall.sdbairui.com//storeapi/Streaming/liveStreamList",
|
url:"https://mall.dmygkeji.com/storeapi/Streaming/liveStreamList",
|
||||||
method:"POST",
|
method:"POST",
|
||||||
headers:{
|
header:{
|
||||||
'Authorization' : 'Bearer' + " " + token
|
'Authorization' : 'Bearer' + " " + token
|
||||||
},
|
},
|
||||||
success(res){
|
success(res){
|
||||||
@@ -207,60 +478,244 @@ const RongIMLib = require('../../static/rongyun.js');
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
uni.request({
|
uni.request({
|
||||||
url:"https://dmmall.sdbairui.com/storeapi/member/memberInfo",
|
url:"https://mall.dmygkeji.com/storeapi/member/memberInfo",
|
||||||
method:"POST",
|
method:"POST",
|
||||||
headers:{
|
header:{
|
||||||
'Authorization' : 'Bearer' + " " + token
|
'Authorization' : 'Bearer' + " " + token
|
||||||
},
|
},
|
||||||
success(res){
|
success(res){
|
||||||
console.log(res.data.data.memberInfo)
|
console.log(res.data)
|
||||||
that.info = res.data.data.memberInfo
|
that.info = res.data.data.memberInfo
|
||||||
|
|
||||||
|
console.log(uni.getStorageSync('userinfo'),123)
|
||||||
|
//当前用户
|
||||||
|
var currentUser = {
|
||||||
|
id : Date.parse(new Date()) + "",
|
||||||
|
nickname : res.data.data.memberInfo.member_nickname + "",
|
||||||
|
avatar: res.data.data.memberInfo.member_avatar
|
||||||
|
};
|
||||||
|
|
||||||
|
var room = {
|
||||||
|
id : a.id + "",
|
||||||
|
name : a.id + ""
|
||||||
|
};
|
||||||
|
that.chatRoomService = getApp().globalData.im
|
||||||
|
console.log(room,currentUser)
|
||||||
|
//构造chatRoomService
|
||||||
|
that.chatRoomService.subscribeRoomMessage(room,currentUser)
|
||||||
|
that.chatRoomService.initialWhenNewMessage(that.whenNewMessage);
|
||||||
|
that.chatRoomService.warrings = that.jinggao
|
||||||
|
//获取当前聊天室数据
|
||||||
|
that.room = that.chatRoomService.room;
|
||||||
|
console.log(that.room)
|
||||||
|
that.chatRoomService.initialWhenOnlineUserChange(that.renqu)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
var config = {
|
let shi = 0;
|
||||||
appkey: 'mgb7ka1',
|
let fen = 0;
|
||||||
debug:true
|
let miao = 0;
|
||||||
};
|
setInterval(() => {
|
||||||
var im = RongIMLib.init(config);
|
shi = parseInt(shi)
|
||||||
var conversationList = []; // 当前已存在的会话列表
|
fen = parseInt(fen)
|
||||||
im.watch({
|
miao = parseInt(miao)
|
||||||
conversation: function(event){
|
miao = miao + 1
|
||||||
var updatedConversationList = event.updatedConversationList; // 更新的会话列表
|
// console.log(miao)
|
||||||
console.log('更新会话汇总:', updatedConversationList);
|
if(fen > 0){
|
||||||
console.log('最新会话列表:', im.Conversation.merge({
|
that.fen = false;
|
||||||
conversationList,
|
|
||||||
updatedConversationList
|
|
||||||
}));
|
|
||||||
},
|
|
||||||
message: function(event){
|
|
||||||
var message = event.message;
|
|
||||||
console.log('收到新消息:', message);
|
|
||||||
},
|
|
||||||
status: function(event){
|
|
||||||
var status = event.status;
|
|
||||||
console.log('连接状态码:', status);
|
|
||||||
}
|
}
|
||||||
});
|
if(miao == 60){
|
||||||
var user = {
|
miao = 0;
|
||||||
token: uni.getStorageSync('rongyun')
|
fen +=1
|
||||||
};
|
}
|
||||||
im.connect(user).then(function(user) {
|
if(fen == 60){
|
||||||
console.log('链接成功, 链接用户 id 为: ', user.id);
|
shi += 1
|
||||||
}).catch(function(error) {
|
fen = 0
|
||||||
console.log('链接失败: ', error.code, error.msg);
|
}
|
||||||
});
|
if(shi < 10){
|
||||||
var chatRoom = im.ChatRoom.get({
|
shi = '0' + shi
|
||||||
id: a.id
|
}
|
||||||
});
|
if(fen < 10){
|
||||||
chatRoom.join({
|
fen = '0' + fen
|
||||||
count: 20 // 进入后, 自动拉取 20 条聊天室最新消息
|
}
|
||||||
}).then(function() {
|
if(miao < 10){
|
||||||
console.log('加入聊天室成功');
|
miao = '0' + miao
|
||||||
});
|
}
|
||||||
|
that.time = shi + ":" + fen + ":" + miao
|
||||||
|
}, 1000);
|
||||||
|
setInterval(()=>{
|
||||||
|
console.log("定时")
|
||||||
|
uni.request({
|
||||||
|
url:"https://mall.dmygkeji.com/storeapi/Streaming/changeLiveRealtimeNumber",
|
||||||
|
method:"POST",
|
||||||
|
header:{
|
||||||
|
'Authorization' : 'Bearer' + " " + token
|
||||||
|
},
|
||||||
|
data:{
|
||||||
|
live_id:that.live_id,
|
||||||
|
realtime_number: that.room.onlineUsers.users.length - 1 < 0 ? 0 : that.room.onlineUsers.users.length - 1
|
||||||
|
},
|
||||||
|
success(res){
|
||||||
|
console.log(JSON.stringify(res))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
10 * 1000)
|
||||||
|
// var roomToken = JSON.parse(options.roomToken);
|
||||||
|
|
||||||
|
|
||||||
|
// //获取当前聊天室数据
|
||||||
|
// this.room = this.chatRoomService.room;
|
||||||
|
// var config = {
|
||||||
|
// appkey: 'mgb7ka1',
|
||||||
|
// debug:true
|
||||||
|
// };
|
||||||
|
// var im = RongIMLib.init(config);
|
||||||
|
// var conversationList = []; // 当前已存在的会话列表
|
||||||
|
// im.watch({
|
||||||
|
// conversation: function(event){
|
||||||
|
// var updatedConversationList = event.updatedConversationList; // 更新的会话列表
|
||||||
|
// console.log('更新会话汇总:', updatedConversationList);
|
||||||
|
// console.log('最新会话列表:', im.Conversation.merge({
|
||||||
|
// conversationList,
|
||||||
|
// updatedConversationList
|
||||||
|
// }));
|
||||||
|
// },
|
||||||
|
// message: function(event){
|
||||||
|
// var message = event.message;
|
||||||
|
// console.log('收到新消息:', message);
|
||||||
|
// },
|
||||||
|
// status: function(event){
|
||||||
|
// var status = event.status;
|
||||||
|
// console.log('连接状态码:', status);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// var user = {
|
||||||
|
// token: uni.getStorageSync('rongyun')
|
||||||
|
// };
|
||||||
|
// console.log(user,123)
|
||||||
|
// im.connect(user).then(function(user) {
|
||||||
|
// console.log('链接成功, 链接用户 id 为: ', user.id);
|
||||||
|
// }).catch(function(error) {
|
||||||
|
// console.log('链接失败: ', error.code, error);
|
||||||
|
// });
|
||||||
|
// var chatRoom = im.ChatRoom.get({
|
||||||
|
// id: a.id
|
||||||
|
// })
|
||||||
|
// chatRoom.join({
|
||||||
|
// count: 20 // 进入后, 自动拉取 20 条聊天室最新消息
|
||||||
|
// }).then(function() {
|
||||||
|
// console.log('加入聊天室成功');
|
||||||
|
// }).catch((err)=>{
|
||||||
|
// console.log(err,262)
|
||||||
|
// })
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
jinggao(text){
|
||||||
|
console.log(text)
|
||||||
|
if(text.message_type == 1){
|
||||||
|
uni.showModal({
|
||||||
|
title: '警告',
|
||||||
|
content: text.content,
|
||||||
|
showCancel:false,
|
||||||
|
success: function (res) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else if(text.message_type == 2){
|
||||||
|
uni.showModal({
|
||||||
|
title: '警告',
|
||||||
|
content: text.content,
|
||||||
|
showCancel:false,
|
||||||
|
success: function (res) {
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.stop()
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
renqu(res){
|
||||||
|
if(res.users.length > this.renqu){
|
||||||
|
this.renqu = res.users.length
|
||||||
|
}
|
||||||
|
this.$forceUpdate()
|
||||||
|
},
|
||||||
|
whenNewMessage (message) {//新消息监听
|
||||||
|
// if(message.type == this.room.MessageType.PROP){
|
||||||
|
// this.propAnimation(parseInt(message.content))
|
||||||
|
// }
|
||||||
|
// setTimeout(() => {
|
||||||
|
// this.contentPosition = 'message-box'+(this.room.messages.length-1);
|
||||||
|
// }, 300)
|
||||||
|
console.log(message)
|
||||||
|
this.danmulist.push(message)
|
||||||
|
if(this.danmulist.length > 7){
|
||||||
|
this.danmulist = this.danmulist.slice(this.danmulist.length - 7)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
bindPickerChange(a){
|
||||||
|
console.log(a.detail.value)
|
||||||
|
this.meiyan = a.detail.value
|
||||||
|
uni.showToast({
|
||||||
|
title: '切换成功',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
},
|
||||||
|
closes1() {
|
||||||
|
console.log(111);
|
||||||
|
},
|
||||||
|
closes(){
|
||||||
|
console.log(this.zhibo)
|
||||||
|
if(!this.zhibo){
|
||||||
|
uni.navigateBack({
|
||||||
|
delta:1
|
||||||
|
});
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
this.chatRoomService.warrings = ()=>{};
|
||||||
|
|
||||||
|
const token = uni.getStorageSync('token');
|
||||||
|
let that = this
|
||||||
|
console.log(that.url)
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '是否关闭直播',
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
uni.request({
|
||||||
|
url:"https://mall.dmygkeji.com/storeapi/Streaming/destroyChatRoom",
|
||||||
|
data:{
|
||||||
|
chatroom_id:that.chatroom_id,
|
||||||
|
live_id:that.live_id,
|
||||||
|
url: that.url
|
||||||
|
},
|
||||||
|
method:"POST",
|
||||||
|
header:{
|
||||||
|
"Authorization" : 'Bearer' + " " + token
|
||||||
|
},
|
||||||
|
success(res){
|
||||||
|
console.log(res)
|
||||||
|
that.stop()
|
||||||
|
that.jieshu = res.data.data
|
||||||
|
that.zhibo = false
|
||||||
|
// uni.navigateBack({
|
||||||
|
// delta: 1
|
||||||
|
// });
|
||||||
|
// that.list= res.data.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else if (res.cancel) {
|
||||||
|
console.log('用户点击取消');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
statechange(e) {
|
statechange(e) {
|
||||||
console.log("statechange:" + JSON.stringify(e));
|
console.log("statechange:" + JSON.stringify(e));
|
||||||
|
console.log(e)
|
||||||
},
|
},
|
||||||
netstatus(e) {
|
netstatus(e) {
|
||||||
// console.log("netstatus:" + JSON.stringify(e));
|
// console.log("netstatus:" + JSON.stringify(e));
|
||||||
@@ -269,6 +724,7 @@ const RongIMLib = require('../../static/rongyun.js');
|
|||||||
console.log("error:" + JSON.stringify(e));
|
console.log("error:" + JSON.stringify(e));
|
||||||
},
|
},
|
||||||
start: function() {
|
start: function() {
|
||||||
|
console.log("开始")
|
||||||
console.log(this.url)
|
console.log(this.url)
|
||||||
this.context.start({
|
this.context.start({
|
||||||
success: (a) => {
|
success: (a) => {
|
||||||
@@ -338,6 +794,10 @@ const RongIMLib = require('../../static/rongyun.js');
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
xianshi(){
|
||||||
|
this.show = true;
|
||||||
|
console.log(111)
|
||||||
|
},
|
||||||
guanbi(){
|
guanbi(){
|
||||||
this.show = false
|
this.show = false
|
||||||
console.log(123)
|
console.log(123)
|
||||||
@@ -354,22 +814,23 @@ const RongIMLib = require('../../static/rongyun.js');
|
|||||||
arr.push(this.list[i].goods_id)
|
arr.push(this.list[i].goods_id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log(arr.join(','))
|
||||||
let that = this
|
let that = this
|
||||||
uni.request({
|
uni.request({
|
||||||
url:"https://dmmall.sdbairui.com/storeapi/Streaming/updateGoods",
|
url:"https://mall.dmygkeji.com/storeapi/Streaming/updateGoods",
|
||||||
method:"POST",
|
method:"POST",
|
||||||
data:{
|
data:{
|
||||||
goods_id:arr.join(',')
|
goods_id:arr.join(',')
|
||||||
},
|
},
|
||||||
headers:{
|
header:{
|
||||||
'Authorization' : 'Bearer' + " " + token
|
'Authorization' : 'Bearer' + " " + token
|
||||||
},
|
},
|
||||||
success(res){
|
success(res){
|
||||||
console.log(res)
|
console.log(res)
|
||||||
uni.request({
|
uni.request({
|
||||||
url:"https://dmmall.sdbairui.com//storeapi/Streaming/liveStreamList",
|
url:"https://mall.dmygkeji.com//storeapi/Streaming/liveStreamList",
|
||||||
method:"POST",
|
method:"POST",
|
||||||
headers:{
|
header:{
|
||||||
'Authorization' : 'Bearer' + " " + token
|
'Authorization' : 'Bearer' + " " + token
|
||||||
},
|
},
|
||||||
success(res){
|
success(res){
|
||||||
|
|||||||
@@ -1,23 +1,47 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="complaint">
|
<view class="complaint">
|
||||||
<view class="complaint-item" v-for="(item, index) in 4" :key="index" @click="toDetailsPage">
|
<view class="complaint-item" v-for="(item, index) in list" :key="index" @click="toDetailsPage(item.complain_id)">
|
||||||
<ComplaintItem></ComplaintItem>
|
<ComplaintItem :info="item"></ComplaintItem>
|
||||||
</view>
|
</view>
|
||||||
|
<u-toast ref="uToast" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import ComplaintItem from '@/components/complaint-item/index'
|
import ComplaintItem from '@/components/complaint-item/index'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {}
|
return {
|
||||||
|
list:[]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
ComplaintItem
|
ComplaintItem
|
||||||
},
|
},
|
||||||
|
onLoad() {
|
||||||
|
this.getlist()
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
toDetailsPage() {
|
// 获取投诉列表
|
||||||
|
getlist(){
|
||||||
|
this.$u.api.reportlist({}).then(res => {
|
||||||
|
console.log(res)
|
||||||
|
if (res.errCode != 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
let arr = res.data.dataList
|
||||||
|
for(let index in arr){
|
||||||
|
this.list.push(arr[index])
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
toDetailsPage(id) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/user/complaintDetails'
|
url: '/pages/user/complaintDetails?id='+id
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="details">
|
<view class="details">
|
||||||
<view class="goods-info">
|
<view class="goods-info">
|
||||||
<image></image>
|
<image :src="info.complain_goods_image"></image>
|
||||||
<view class="text">
|
<view class="text">
|
||||||
<view class="name u-line-1">心机小黑裙连衣裙赫本风夏季爆款dlk...</view>
|
<view class="name u-line-1">{{info.complain_goods_name}}</view>
|
||||||
<view class="num">共一件商品</view>
|
<view class="num">共{{info.complain_goods_num}}件商品</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="worker-info">
|
<view class="worker-info">
|
||||||
@@ -12,28 +12,52 @@
|
|||||||
<view class="item">
|
<view class="item">
|
||||||
<view>
|
<view>
|
||||||
<view class="item-title">姓名</view>
|
<view class="item-title">姓名</view>
|
||||||
<view class="value">李先生</view>
|
<view class="value">{{info.takeawayer_name}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view class="item-title">手机号</view>
|
<view class="item-title">手机号</view>
|
||||||
<view class="value">1561</view>
|
<view class="value">{{info.takeawayer_mobile}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view class="item-title">公司名称</view>
|
<view class="item-title">公司名称</view>
|
||||||
<view class="value">申通快递公司</view>
|
<view class="value">{{info.company}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="reason">
|
<view class="reason">
|
||||||
<view class="title">投诉原因</view>
|
<view class="title">投诉原因</view>
|
||||||
<view class="value u-line-4">太慢了太慢了!!!!</view>
|
<view class="value u-line-4">{{info.complain_desc}}</view>
|
||||||
</view>
|
</view>
|
||||||
|
<u-toast ref="uToast" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {}
|
return {
|
||||||
|
info:{}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(option) {
|
||||||
|
this.getinfo(option.id)
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
getinfo(id){
|
||||||
|
let that = this;
|
||||||
|
this.$u.api.reportdetail({
|
||||||
|
id: id
|
||||||
|
}).then(res => {
|
||||||
|
console.log(res)
|
||||||
|
if (res.errCode != 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.info = res.data.info;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,80 +1,153 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<view class="tab-swiper">
|
<view class="tab-swiper">
|
||||||
<u-tabs-swiper ref="uTabs" :list="list" :current="current" @change="tabsChange" active-color="#FF780F" inactive-color="#333333" font-size="30" gutter="317" height="98" :show-bar="false" swiperWidth="750" :is-scroll=false></u-tabs-swiper>
|
<u-tabs-swiper
|
||||||
|
ref="uTabs"
|
||||||
|
:list="list"
|
||||||
|
:current="current"
|
||||||
|
@change="tabsChange"
|
||||||
|
active-color="#FF780F"
|
||||||
|
inactive-color="#333333"
|
||||||
|
font-size="30"
|
||||||
|
gutter="317"
|
||||||
|
height="98"
|
||||||
|
:show-bar="false"
|
||||||
|
swiperWidth="750"
|
||||||
|
:is-scroll="false"
|
||||||
|
></u-tabs-swiper>
|
||||||
</view>
|
</view>
|
||||||
<swiper :current="swiperCurrent" @animationfinish="animationfinish">
|
<view class="box">
|
||||||
<swiper-item class="swiper-item">
|
<view v-for="(item, index) in newlist" :key="index"><ContentItem :info="item" :type="type" @del="del"></ContentItem></view>
|
||||||
<scroll-view scroll-y style="height: 100%;width: 100%;" class="list">
|
|
||||||
<view v-for="(item, index) in 5" :key="index">
|
|
||||||
<ContentItem :cur="current" :delItem="showPopup"></ContentItem>
|
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
|
||||||
</swiper-item>
|
|
||||||
<swiper-item class="swiper-item">
|
|
||||||
<scroll-view scroll-y style="height: 100%;width: 100%;" class="video-list">
|
|
||||||
<view v-for="(item, index) in 5" :key="index">
|
|
||||||
<ContentItem :cur="current" :delItem="showPopup"></ContentItem>
|
|
||||||
</view>
|
|
||||||
</scroll-view>
|
|
||||||
</swiper-item>
|
|
||||||
</swiper>
|
|
||||||
<u-popup v-model="show" mode="center">
|
<u-popup v-model="show" mode="center">
|
||||||
<view class="close-popup">
|
<view class="close-popup">
|
||||||
<view class="tips">确定要删除该视频吗</view>
|
<view class="tips">{{msg}}</view>
|
||||||
<view class="btn">
|
<view class="btn">
|
||||||
<view class="cancel" @click="show = false">取消</view>
|
<view class="cancel" @click="show = false">取消</view>
|
||||||
<view class="confirm">确定</view>
|
<view class="confirm" @click="delarticle">确定</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</u-popup>
|
</u-popup>
|
||||||
|
<u-toast ref="uToast" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import ContentItem from '@/components/content-item/index'
|
import ContentItem from '@/components/content-item/index';
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
show: false,
|
show: false,
|
||||||
current: 0,
|
current: 0,
|
||||||
swiperCurrent: 0,
|
swiperCurrent: 0,
|
||||||
list: [{
|
list: [
|
||||||
|
{
|
||||||
name: '图文'
|
name: '图文'
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
name: '视频'
|
name: '视频'
|
||||||
}],
|
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
type: 1,
|
||||||
|
num: 1,
|
||||||
|
newlist: [],
|
||||||
|
delid:null,
|
||||||
|
msg:""
|
||||||
|
};
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
ContentItem
|
ContentItem
|
||||||
},
|
},
|
||||||
|
onLoad() {
|
||||||
|
this.getlist();
|
||||||
|
},
|
||||||
|
onReachBottom() {
|
||||||
|
this.num++;
|
||||||
|
this.getlist();
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
showPopup() {
|
getlist() {
|
||||||
|
let that = this;
|
||||||
|
this.$u.api.articlelist({
|
||||||
|
type: that.type,
|
||||||
|
page: that.num
|
||||||
|
}).then(res => {
|
||||||
|
if (res.errCode != 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
let arr = res.data.articleList;
|
||||||
|
for (let index in arr) {
|
||||||
|
that.newlist.push(arr[index]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
del(e) {
|
||||||
|
// 提示是否删除弹窗
|
||||||
|
if(this.type==1){
|
||||||
|
this.msg="确定要删除该图文吗?"
|
||||||
|
}else{
|
||||||
|
this.msg="确定要删除该视频吗?"
|
||||||
|
}
|
||||||
this.show = true;
|
this.show = true;
|
||||||
|
this.delid = e
|
||||||
|
},
|
||||||
|
// 删除文章
|
||||||
|
delarticle(){
|
||||||
|
let that = this;
|
||||||
|
that.show = false;
|
||||||
|
this.$u.api.delarticle({
|
||||||
|
article_id: that.delid
|
||||||
|
}).then(res => {
|
||||||
|
console.log(res)
|
||||||
|
if (res.errCode != 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
// 删除后更新页面
|
||||||
|
this.delid = null
|
||||||
|
this.newlist = [];
|
||||||
|
that.num=1
|
||||||
|
that.getlist()
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
tabsChange(index) {
|
tabsChange(index) {
|
||||||
this.swiperCurrent = index;
|
this.current = index;
|
||||||
},
|
this.type = index + 1;
|
||||||
animationfinish(e) {
|
this.num = 0;
|
||||||
let current = e.detail.current;
|
this.newlist = [];
|
||||||
// this.$refs.uTabs.setFinishCurrent(current);
|
this.getlist();
|
||||||
this.swiperCurrent = current;
|
}
|
||||||
this.current = current;
|
}
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.tab-swiper {
|
||||||
|
width: 100%;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
z-index: 1000;
|
||||||
|
}
|
||||||
.content {
|
.content {
|
||||||
min-height: calc(100vh - var(--window-top));
|
min-height: calc(100vh - var(--window-top));
|
||||||
background-color: #ECECEC;
|
background-color: #ececec;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
> uni-swiper {
|
> uni-swiper {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
.tab-swiper {
|
.box{
|
||||||
margin: 2rpx 0 20rpx 0;
|
padding-top: 120rpx;
|
||||||
}
|
}
|
||||||
.close-popup {
|
.close-popup {
|
||||||
background: rgba(255, 255, 255, 1);
|
background: rgba(255, 255, 255, 1);
|
||||||
@@ -88,7 +161,7 @@ export default {
|
|||||||
}
|
}
|
||||||
.btn {
|
.btn {
|
||||||
width: 420rpx;
|
width: 420rpx;
|
||||||
border-top: 2rpx #ECECEC solid;
|
border-top: 2rpx #ececec solid;
|
||||||
display: flex;
|
display: flex;
|
||||||
> view {
|
> view {
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
@@ -98,10 +171,10 @@ export default {
|
|||||||
}
|
}
|
||||||
.cancel {
|
.cancel {
|
||||||
color: #333333;
|
color: #333333;
|
||||||
border-right: 2rpx #ECECEC solid;
|
border-right: 2rpx #ececec solid;
|
||||||
}
|
}
|
||||||
.confirm {
|
.confirm {
|
||||||
color: #FF780F;
|
color: #ff780f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,77 +1,190 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="details">
|
<view class="details">
|
||||||
<view class="main"></view>
|
<view class="main">
|
||||||
<view></view>
|
<view class="title">{{ info.article_title }}</view>
|
||||||
|
<view class="detail">{{ info.article_content }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="imgbox">
|
||||||
|
<view v-if="type==1">
|
||||||
|
<image :src="list" mode="" @tap="viewImage" v-for="list in info.article_image"></image>
|
||||||
|
</view>
|
||||||
|
<view v-else>
|
||||||
|
<video :src="info.video_path" controls></video>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<view class="data-list">
|
<view class="data-list">
|
||||||
<view>
|
<view>
|
||||||
<image src="/static/image/user/2.png"></image>
|
<image src="/static/image/user/2.png"></image>
|
||||||
<text>2.5w</text>
|
<text>{{ info.comment_num }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<image src="/static/image/user/3.png" v-if="0"></image>
|
<image src="/static/image/user/3.png" v-if="0"></image>
|
||||||
<image src="/static/image/user/7.png" v-else></image>
|
<image src="/static/image/user/7.png" v-else></image>
|
||||||
<text>2.5w</text>
|
<text>{{ info.collect_num }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<image src="/static/image/user/4.png" v-if="0"></image>
|
<image src="/static/image/user/4.png" v-if="0"></image>
|
||||||
<image src="/static/image/user/6.png" v-else></image>
|
<image src="/static/image/user/6.png" v-else></image>
|
||||||
<text>2.5w</text>
|
<text>{{ info.like_num }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="comment-list">
|
<view class="comment-list">
|
||||||
<view class="item" v-for="(item, index) in 4" :key="index">
|
<view class="item" v-for="(item, index) in info.articlecomment" :key="index">
|
||||||
<view class="info">
|
<view class="info">
|
||||||
<image></image>
|
<image :src="item.member_avatar"></image>
|
||||||
<view class="center">
|
<view class="center">
|
||||||
<view class="name">用户1</view>
|
<view class="name">{{item.member_nickname}}{{item.reply_member_nickname==null?"评论了文章":" 回复了 "+item.reply_member_nickname}}</view>
|
||||||
<view class="time">6小时前</view>
|
<view class="time">{{item.create_time}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="btn" @click="showChat=true">回复</view>
|
<view class="btn" @click="showreply(item.id,item.member_id)" v-if="item.pid==0">回复</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="content u-line-1">德铭阳光赞德铭阳光赞德铭阳光赞</view>
|
<view class="content u-line-1">{{item.content}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<u-popup v-model="showChat" mode="bottom" :mask=false>
|
<u-popup v-model="showChat" mode="bottom" :mask="false">
|
||||||
<view class="chat">
|
<view class="chat">
|
||||||
<view class="input-box">
|
<view class="input-box">
|
||||||
<input type="text">
|
<input type="text" v-model="content"/>
|
||||||
<view class="btn">发送</view>
|
<view class="btn" @click="reply">发送</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</u-popup>
|
</u-popup>
|
||||||
|
<u-toast ref="uToast" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
showChat: false
|
showChat: false,
|
||||||
}
|
id: 0,
|
||||||
|
info: {
|
||||||
|
article_image: []
|
||||||
|
},
|
||||||
|
type:1,
|
||||||
|
content:"",
|
||||||
|
pid:null,
|
||||||
|
replyid:null
|
||||||
|
};
|
||||||
},
|
},
|
||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
this.setNavTitle(option.current);
|
this.setNavTitle(option.current);
|
||||||
|
this.type = option.current
|
||||||
|
this.id = option.id;
|
||||||
|
this.getdetail();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setNavTitle(current) {
|
// 展示回复弹框
|
||||||
uni.setNavigationBarTitle({
|
showreply(id,replyid){
|
||||||
title: current == 0 ? "图文详情" : "视频详情"
|
this.showChat = true
|
||||||
|
this.pid = id
|
||||||
|
this.replyid = replyid
|
||||||
|
},
|
||||||
|
// 回复评论
|
||||||
|
reply(){
|
||||||
|
if(this.content==""){
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title:"内容不能为空",
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let that = this;
|
||||||
|
this.$u.api.reply({
|
||||||
|
pid:that.pid,
|
||||||
|
content:that.content,
|
||||||
|
article_id: that.id,
|
||||||
|
reply_id:that.replyid
|
||||||
|
}).then(res => {
|
||||||
|
if (res.errCode != 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.pid = "";
|
||||||
|
this.content = "";
|
||||||
|
this.getdetail();
|
||||||
|
this.showChat = false
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'success'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
// 设置顶部标题
|
||||||
|
setNavTitle(current) {
|
||||||
|
uni.setNavigationBarTitle({
|
||||||
|
title: current == 1 ? '图文详情' : '视频详情'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 获取文章详情
|
||||||
|
getdetail() {
|
||||||
|
let that = this;
|
||||||
|
this.$u.api.getdetail({
|
||||||
|
article_id: that.id
|
||||||
|
}).then(res => {
|
||||||
|
if (res.errCode != 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.info = res.data.article[0];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 预览图片
|
||||||
|
viewImage() {
|
||||||
|
uni.previewImage({
|
||||||
|
urls: this.info.article_image
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.details {
|
.details {
|
||||||
min-height: calc(100vh - var(--window-top));
|
min-height: calc(100vh - var(--window-top));
|
||||||
background-color: #ECECEC;
|
background-color: #ececec;
|
||||||
.main {
|
.main {
|
||||||
height: 740rpx;
|
margin: 2rpx 0rpx 0;
|
||||||
margin: 2rpx 0rpx;
|
background-color: #ffffff;
|
||||||
|
.title {
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 34rpx;
|
||||||
|
padding: 30rpx 0;
|
||||||
|
}
|
||||||
|
.detail {
|
||||||
|
width: 100%;
|
||||||
|
text-indent: 40rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
text-align: justify;
|
||||||
|
padding: 0 30rpx 85rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.imgbox {
|
||||||
|
width: 750rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-start;
|
||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
|
image {
|
||||||
|
width: 210rpx;
|
||||||
|
height: 210rpx;
|
||||||
|
margin: 10rpx 15rpx;
|
||||||
|
}
|
||||||
|
video {
|
||||||
|
width: 210rpx;
|
||||||
|
height: 210rpx;
|
||||||
|
margin: 10rpx 15rpx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.comment-list {
|
.comment-list {
|
||||||
.item {
|
.item {
|
||||||
background-color: #FFFFFF;
|
background-color: #ffffff;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
margin-bottom: 2rpx;
|
margin-bottom: 2rpx;
|
||||||
.info {
|
.info {
|
||||||
@@ -109,7 +222,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.data-list {
|
.data-list {
|
||||||
background-color: #FFFFFF;
|
background-color: #ffffff;
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 88rpx;
|
height: 88rpx;
|
||||||
padding: 0 30rpx;
|
padding: 0 30rpx;
|
||||||
@@ -141,12 +254,12 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.chat {
|
.chat {
|
||||||
background-color: #ECECEC;
|
background-color: #ececec;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 98rpx;
|
height: 98rpx;
|
||||||
padding: 19rpx 30rpx;
|
padding: 19rpx 30rpx;
|
||||||
.input-box {
|
.input-box {
|
||||||
background-color: #FFFFFF;
|
background-color: #ffffff;
|
||||||
width: 690rpx;
|
width: 690rpx;
|
||||||
height: 60rpx;
|
height: 60rpx;
|
||||||
background: rgba(255, 255, 255, 1);
|
background: rgba(255, 255, 255, 1);
|
||||||
|
|||||||
@@ -3,29 +3,54 @@
|
|||||||
<view class="lately">
|
<view class="lately">
|
||||||
<view class="title">最新</view>
|
<view class="title">最新</view>
|
||||||
<view class="items">
|
<view class="items">
|
||||||
<view v-for="(item, index) in 3" :key="index">
|
<view v-for="(item, index) in newfans" :key="index">
|
||||||
<FansItem></FansItem>
|
<FansItem :info="item"></FansItem>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="before">
|
<view class="before">
|
||||||
<view class="title">早前</view>
|
<view class="title">早前</view>
|
||||||
<view class="items">
|
<view class="items">
|
||||||
<view v-for="(item, index) in 13" :key="index">
|
<view v-for="(item, index) in myfans" :key="index">
|
||||||
<FansItem></FansItem>
|
<FansItem :info="item"></FansItem>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<u-toast ref="uToast" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import FansItem from '@/components/fans-item/index'
|
import FansItem from '@/components/fans-item/index'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {}
|
return {
|
||||||
|
myfans:[],
|
||||||
|
newfans:[]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
FansItem
|
FansItem
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
this.fans()
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
fans(){
|
||||||
|
let that = this;
|
||||||
|
this.$u.api.myfanlist({}).then(res => {
|
||||||
|
console.log(res);
|
||||||
|
if (res.errCode != 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
that.myfans = res.data.fans
|
||||||
|
that.newfans = res.data.fansNewest
|
||||||
|
console.log(that.myfans,that.newfans)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
117
pages/user/feedback.vue
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
<template>
|
||||||
|
<view class="write-complaints">
|
||||||
|
<view class="main-container">
|
||||||
|
<view class="text-box">
|
||||||
|
<u-input class="textarea" placeholder="发表您的意见吧,我们会做得更好。 (必填)" v-model="text" type="textarea" :clearable="false" :maxlength="200" />
|
||||||
|
<span class="text-length">{{ text.length }}/200</span>
|
||||||
|
</view>
|
||||||
|
<u-input class="phone" placeholder="请输入手机号方便联系 (非必填)" v-model="phone" type="number" />
|
||||||
|
</view>
|
||||||
|
<view class="write-btn" @click="submit">发表意见</view>
|
||||||
|
<u-toast ref="uToast" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
phone: '',
|
||||||
|
text: '',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
submit() {
|
||||||
|
if(!this.verifyContent()) return false;
|
||||||
|
// console.log(this.phone);
|
||||||
|
// console.log(this.text);
|
||||||
|
this.$u.toast('提交成功');
|
||||||
|
this.phone = "";
|
||||||
|
this.text = "";
|
||||||
|
},
|
||||||
|
verifyContent() {
|
||||||
|
if(this.$u.test.isEmpty(this.text)) {
|
||||||
|
this.$u.toast('内容不可为空');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!this.$u.test.isEmpty(this.phone)) {
|
||||||
|
if(!this.$u.test.mobile(this.phone)) {
|
||||||
|
this.$u.toast('手机格式错误');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
writeFeedback() {
|
||||||
|
if(!this.verifyContent()) return false;
|
||||||
|
this.$u.api.writeFeedback({
|
||||||
|
fb_content: this.text,
|
||||||
|
fb_images: this.imageList,
|
||||||
|
}).then(res => {
|
||||||
|
if(res.errCode == 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
duration: 2000,
|
||||||
|
callback:() => {
|
||||||
|
this.$u.route({
|
||||||
|
type: "navigateBack",
|
||||||
|
url: '/pageE/more/Complaints',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$u.toast(res.message);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.write-complaints {
|
||||||
|
min-height: calc(100vh - var(--window-top));
|
||||||
|
background-color: #ECECEC;
|
||||||
|
.main-container {
|
||||||
|
background-color: #ffffff;
|
||||||
|
.text-box {
|
||||||
|
padding-bottom: 60rpx;
|
||||||
|
position: relative;
|
||||||
|
&::after {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
height: 3rpx;
|
||||||
|
width: 750rpx;
|
||||||
|
background-color: #ECECEC;
|
||||||
|
}
|
||||||
|
.text-length {
|
||||||
|
height: 60rpx;
|
||||||
|
position: absolute;
|
||||||
|
right: 40rpx;
|
||||||
|
bottom: 0;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/deep/ .textarea {
|
||||||
|
padding: 0 30rpx !important;
|
||||||
|
width: 100% !important;
|
||||||
|
margin-bottom: 10rpx;
|
||||||
|
}
|
||||||
|
/deep/ .phone {
|
||||||
|
padding: 20rpx 30rpx !important;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.write-btn {
|
||||||
|
margin: 120rpx auto 0;
|
||||||
|
width: 690rpx;
|
||||||
|
height: 98rpx;
|
||||||
|
background: rgba(255,120,15,1);
|
||||||
|
border-radius: 46rpx;
|
||||||
|
font-size: 36rpx;
|
||||||
|
color: rgba(255,255,255,1);
|
||||||
|
text-align: center;
|
||||||
|
line-height: 98rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="user">
|
<view class="user">
|
||||||
<view class="head" @click="toOthersPage('info')">
|
<view class="head" @click="toOthersPage('info')">
|
||||||
<view class="info">
|
<view class="info" :key="num">
|
||||||
<image></image>
|
<image :src="info.member_avatar+'?'+new Date().getTime()"></image>
|
||||||
<view class="name">
|
<view class="name">
|
||||||
<text>萨大赛</text>
|
<text>{{info.member_nickname==null?"新用户":info.member_nickname}}</text>
|
||||||
<text>账号:123456789</text>
|
<text>账号:{{info.member_name}}</text>
|
||||||
<text>个性签名:为梦努力</text>
|
<text class="u-line-2">个性签名:{{info.signature==""?"该用户很懒没有签名!":info.signature}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<image src="/static/image/user/1.png"></image>
|
<image src="/static/image/user/1.png"></image>
|
||||||
@@ -23,16 +23,141 @@
|
|||||||
<text>骑手投诉</text>
|
<text>骑手投诉</text>
|
||||||
<image src="/static/image/user/1.png"></image>
|
<image src="/static/image/user/1.png"></image>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="nav" @click="toOthersPage('feedback')">
|
||||||
|
<text>用户反馈</text>
|
||||||
|
<image src="/static/image/user/1.png"></image>
|
||||||
|
</view>
|
||||||
|
<view class="nav" @click="viewAgreement(1)">
|
||||||
|
<text>用户协议</text>
|
||||||
|
<image src="/static/image/user/1.png"></image>
|
||||||
|
</view>
|
||||||
|
<view class="nav" @click="viewAgreement(2)">
|
||||||
|
<text>隐私政策</text>
|
||||||
|
<image src="/static/image/user/1.png"></image>
|
||||||
|
</view>
|
||||||
|
<view class="nav" @click="clearCache">
|
||||||
|
<text>清除缓存</text>
|
||||||
|
<text>{{ fileSizeString }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="nav" @click="isLoginOut = true">
|
||||||
|
<text>退出登录</text>
|
||||||
|
<image src="/static/image/user/1.png"></image>
|
||||||
|
</view>
|
||||||
|
<u-modal v-model="isLoginOut" show-confirm-button show-cancel-button :content="content" @confirm="loginOut"></u-modal>
|
||||||
|
<u-toast ref="uToast" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name:"user",
|
name:"user",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
info:{},
|
||||||
|
isLoginOut: false,
|
||||||
|
content: "是否退出登录?",
|
||||||
|
num:0,
|
||||||
|
fileSizeString: "", // 缓存大小
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
isLoginOut() {
|
||||||
|
// console.log(this.isLoginOut);
|
||||||
|
// if (this.isLoginOut) {
|
||||||
|
// uni.hideTabBar();
|
||||||
|
// } else {
|
||||||
|
// setTimeout(function() {
|
||||||
|
// uni.showTabBar();
|
||||||
|
// },200)
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
this.getCache();
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.getmyinfo()
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 获取缓存
|
||||||
|
getCache() {
|
||||||
|
let _this = this;
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
plus.cache.calculate(function(size) {
|
||||||
|
console.log(size);
|
||||||
|
let sizeCache = size;
|
||||||
|
if (sizeCache == 0) {
|
||||||
|
_this.fileSizeString = "0B";
|
||||||
|
} else if (sizeCache < 1024) {
|
||||||
|
_this.fileSizeString = sizeCache + "B";
|
||||||
|
} else if (sizeCache < 1048576) {
|
||||||
|
_this.fileSizeString = (sizeCache / 1024).toFixed(2) + "KB";
|
||||||
|
} else if (sizeCache < 1073741824) {
|
||||||
|
_this.fileSizeString = (sizeCache / 1048576).toFixed(2) + "MB";
|
||||||
|
} else {
|
||||||
|
_this.fileSizeString = (sizeCache / 1073741824).toFixed(2) + "GB";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
// 清除缓存
|
||||||
|
clearCache() {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
uni.showModal({
|
||||||
|
title: "确定要清理缓存吗?",
|
||||||
|
cancelColor: "#999",
|
||||||
|
confirmColor: "#f00",
|
||||||
|
success: (res) => {
|
||||||
|
// console.log(res);
|
||||||
|
if (res.confirm) {
|
||||||
|
plus.cache.clear(function(e) {
|
||||||
|
console.log(e);
|
||||||
|
})
|
||||||
|
this.getCache();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
// 退出登陆
|
||||||
|
loginOut(){
|
||||||
|
uni.clearStorage();
|
||||||
|
this.imService.disconnect();
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: "退出登陆成功!",
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
uni.reLaunch({
|
||||||
|
url:"../login/login"
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 获取个人信息
|
||||||
|
getmyinfo(){
|
||||||
|
let that = this;
|
||||||
|
this.$u.api.getshopinfo({}).then(res => {
|
||||||
|
console.log(res);
|
||||||
|
if (res.errCode != 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.info = res.data.memberInfo
|
||||||
|
this.num++
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
toOthersPage(url) {
|
toOthersPage(url) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/user/' + url
|
url: '/pages/user/' + url
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
viewAgreement(id) {
|
||||||
|
this.$u.route({
|
||||||
|
url: '/pages/login/agreements',
|
||||||
|
params: {
|
||||||
|
id: id
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -54,10 +179,10 @@ export default {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
>image{
|
>image{
|
||||||
|
flex-shrink: 0;
|
||||||
width: 110rpx;
|
width: 110rpx;
|
||||||
height: 110rpx;
|
height: 110rpx;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background-color: #0f0;
|
|
||||||
}
|
}
|
||||||
.name{
|
.name{
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
|
|||||||
@@ -1,45 +1,129 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="info">
|
<view class="info">
|
||||||
<view class="head" @click="showImage=true">
|
<view class="head" @click="chooseImage">
|
||||||
<image></image>
|
<image :src="fileurl+'?'+new Date().getTime()"></image>
|
||||||
<text>更换头像</text>
|
<text>更换头像</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<text class="title">用户名</text>
|
<text class="title" v-if="role == 2">店铺名称</text>
|
||||||
<text class="value">兽兽</text>
|
<text class="title" v-else>达人名称</text>
|
||||||
|
<input type="text" value="" v-model="info.member_nickname" placeholder="请输入用户名"/>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<text class="title">个性签名</text>
|
<text class="title">个性签名</text>
|
||||||
<text class="value">变瘦变高变有钱</text>
|
<input type="text" value="" v-model="info.signature" placeholder="请输入个性签名"/>
|
||||||
</view>
|
</view>
|
||||||
<view class="password" @click="updatePwd">
|
<view class="password" @click="updatePwd" v-if="role != 4">
|
||||||
<text>修改密码</text>
|
<text>修改密码</text>
|
||||||
<image src="/static/image/user/1.png"></image>
|
<image src="/static/image/user/1.png"></image>
|
||||||
</view>
|
</view>
|
||||||
<u-popup v-model="showImage" mode="bottom">
|
<u-toast ref="uToast" />
|
||||||
<view class="image-popup">
|
|
||||||
<view @click="chooseImage('camera')">拍摄新照片</view>
|
|
||||||
<view @click="chooseImage('album')">从相册选取</view>
|
|
||||||
</view>
|
|
||||||
</u-popup>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name:"info",
|
name: 'info',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
showImage: false
|
fileurl: "",
|
||||||
|
filename:"",
|
||||||
|
info:{},
|
||||||
|
num:0,
|
||||||
|
role: 0,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
this.getmyinfo();
|
||||||
|
let userinfo = uni.getStorageSync("userinfo");
|
||||||
|
this.role = userinfo.role;
|
||||||
|
// console.log(this.role);
|
||||||
|
},
|
||||||
|
// 保存信息
|
||||||
|
onNavigationBarButtonTap() {
|
||||||
|
let that = this;
|
||||||
|
let obj ={
|
||||||
|
nickname:that.info.member_nickname,
|
||||||
|
avatar:that.filename,
|
||||||
|
signature:that.info.signature
|
||||||
}
|
}
|
||||||
|
console.log(obj)
|
||||||
|
this.$u.api.changeinfo({
|
||||||
|
nickname:that.info.member_nickname,
|
||||||
|
avatar:that.filename,
|
||||||
|
signature:that.info.signature
|
||||||
|
}).then(res => {
|
||||||
|
console.log(res);
|
||||||
|
if (res.errCode != 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
uni.navigateBack({
|
||||||
|
delta:1
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 获取个人信息
|
||||||
|
getmyinfo(){
|
||||||
|
let that = this;
|
||||||
|
this.$u.api.getshopinfo({}).then(res => {
|
||||||
|
console.log(res);
|
||||||
|
if (res.errCode != 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.info = res.data.memberInfo
|
||||||
|
this.fileurl = res.data.memberInfo.member_avatar
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 获取图片,上传图片
|
||||||
chooseImage(sourceType) {
|
chooseImage(sourceType) {
|
||||||
|
let that = this;
|
||||||
|
let photo_type = "";
|
||||||
|
if (this.role == 2) {
|
||||||
|
photo_type = "store_avatar"
|
||||||
|
} else {
|
||||||
|
photo_type = "avatar"
|
||||||
|
}
|
||||||
|
const token = uni.getStorageSync('token');
|
||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: 1,
|
count: 1,
|
||||||
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
||||||
sourceType: [sourceType],
|
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
console.log(JSON.stringify(res.tempFilePaths));
|
console.log(JSON.stringify(res.tempFilePaths));
|
||||||
|
const tempFilePaths = res.tempFilePaths;
|
||||||
|
uni.uploadFile({
|
||||||
|
url: 'https://mall.dmygkeji.com/storeapi/Upload/uploadFile',
|
||||||
|
filePath: tempFilePaths[0],
|
||||||
|
name: photo_type,
|
||||||
|
formData:{
|
||||||
|
name: photo_type,
|
||||||
|
store_id: that.info.store_id
|
||||||
|
},
|
||||||
|
header:{
|
||||||
|
Authorization:'Bearer' + " " + token
|
||||||
|
},
|
||||||
|
success: uploadFileRes => {
|
||||||
|
let obj = JSON.parse(uploadFileRes.data)
|
||||||
|
that.fileurl = obj.data.file_path+'?'+new Date().getTime()
|
||||||
|
that.filename = obj.data.file_name
|
||||||
|
that.num++
|
||||||
|
console.log(that.fileurl,that.filename)
|
||||||
|
},
|
||||||
|
fail: (res) => {
|
||||||
|
console.log(res);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -48,8 +132,8 @@ export default {
|
|||||||
url: '/pages/user/updatePassword'
|
url: '/pages/user/updatePassword'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.info {
|
.info {
|
||||||
@@ -67,11 +151,10 @@ export default {
|
|||||||
width: 120rpx;
|
width: 120rpx;
|
||||||
height: 120rpx;
|
height: 120rpx;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background-color: #0f0;
|
|
||||||
}
|
}
|
||||||
> text {
|
> text {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #FF780F;
|
color: #ff780f;
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
}
|
}
|
||||||
margin-bottom: 2rpx;
|
margin-bottom: 2rpx;
|
||||||
@@ -114,12 +197,12 @@ export default {
|
|||||||
.image-popup {
|
.image-popup {
|
||||||
padding: 0 30rpx;
|
padding: 0 30rpx;
|
||||||
> view {
|
> view {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: rgba(51, 51, 51, 1);
|
color: rgba(51, 51, 51, 1);
|
||||||
line-height: 98rpx;
|
line-height: 98rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
&:first-child {
|
&:first-child {
|
||||||
border-bottom: 2rpx solid #EBEBEB;
|
border-bottom: 2rpx solid #ebebeb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
324
pages/user/myinfo.vue
Normal file
@@ -0,0 +1,324 @@
|
|||||||
|
<template>
|
||||||
|
<view class="user">
|
||||||
|
<view class="head" @click="toOthersPage('info')">
|
||||||
|
<view class="info">
|
||||||
|
<image :src="info.member_avatar + '?' + (new Date().getTime())"></image>
|
||||||
|
<view class="name">
|
||||||
|
<text>{{info.member_nickname==null?"新用户":info.member_nickname}}</text>
|
||||||
|
<text>账号:{{info.member_name}}</text>
|
||||||
|
<text class="u-line-2">个性签名:{{info.signature==""?"该用户很懒没有签名!":info.signature}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<image src="/static/image/user/1.png"></image>
|
||||||
|
</view>
|
||||||
|
<view class="nav" @click="navtos()">
|
||||||
|
<text>活动消息</text>
|
||||||
|
<image src="/static/image/user/1.png"></image>
|
||||||
|
</view>
|
||||||
|
<view class="nav" @click="toOthersPage('fans')">
|
||||||
|
<text>我的粉丝</text>
|
||||||
|
<image src="/static/image/user/1.png"></image>
|
||||||
|
</view>
|
||||||
|
<view class="nav" @click="toOthersPage('content')">
|
||||||
|
<text>内容管理</text>
|
||||||
|
<image src="/static/image/user/1.png"></image>
|
||||||
|
</view>
|
||||||
|
<view class="nav" @click="clearCache">
|
||||||
|
<text>清除缓存</text>
|
||||||
|
<text>{{ fileSizeString }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="nav" @click="is_loginout = true">
|
||||||
|
<text>退出登录</text>
|
||||||
|
<image src="/static/image/user/1.png"></image>
|
||||||
|
</view>
|
||||||
|
<view class="release-btn" @click="publish">
|
||||||
|
<image src="../../static/image/index/publish.png"></image>
|
||||||
|
<view class="text">发布</view>
|
||||||
|
</view>
|
||||||
|
<u-popup v-model="publishstate" mode="bottom">
|
||||||
|
<view class="publish">
|
||||||
|
<view class="list">
|
||||||
|
<view @click="navto('release/tosign')">
|
||||||
|
<image src="../../static/image/index/live.png"></image>
|
||||||
|
<text>直播</text>
|
||||||
|
</view>
|
||||||
|
<view @click="navto('release/index')">
|
||||||
|
<image src="../../static/image/index/photo.png"></image>
|
||||||
|
<text>图文</text>
|
||||||
|
</view>
|
||||||
|
<view @click="navto('release/video')">
|
||||||
|
<image src="../../static/image/index/video.png"></image>
|
||||||
|
<text>视频</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<image src="../../static/image/index/close.png" class="off" @click="close"></image>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
<u-modal v-model="is_loginout" show-confirm-button show-cancel-button :content="content" @confirm="loginOut"></u-modal>
|
||||||
|
<u-toast ref="uToast" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name:"user",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
publishstate: false,
|
||||||
|
is_loginout: false,
|
||||||
|
content: "是否退出登录?",
|
||||||
|
info:{},
|
||||||
|
fileSizeString: "", // 缓存大小
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onShow(){
|
||||||
|
this.getmyinfo()
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
this.getCache();
|
||||||
|
const user = uni.getStorageSync('userinfo');
|
||||||
|
console.log(user)
|
||||||
|
this.imService.login(user.member_id,user.member_nickname,user.member_avatar)
|
||||||
|
this.imService.connectIM()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 获取缓存
|
||||||
|
getCache() {
|
||||||
|
let _this = this;
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
plus.cache.calculate(function(size) {
|
||||||
|
console.log(size);
|
||||||
|
let sizeCache = size;
|
||||||
|
if (sizeCache == 0) {
|
||||||
|
_this.fileSizeString = "0B";
|
||||||
|
} else if (sizeCache < 1024) {
|
||||||
|
_this.fileSizeString = sizeCache + "B";
|
||||||
|
} else if (sizeCache < 1048576) {
|
||||||
|
_this.fileSizeString = (sizeCache / 1024).toFixed(2) + "KB";
|
||||||
|
} else if (sizeCache < 1073741824) {
|
||||||
|
_this.fileSizeString = (sizeCache / 1048576).toFixed(2) + "MB";
|
||||||
|
} else {
|
||||||
|
_this.fileSizeString = (sizeCache / 1073741824).toFixed(2) + "GB";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
// 清除缓存
|
||||||
|
clearCache() {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
uni.showModal({
|
||||||
|
title: "确定要清理缓存吗?",
|
||||||
|
cancelColor: "#999",
|
||||||
|
confirmColor: "#f00",
|
||||||
|
success: (res) => {
|
||||||
|
// console.log(res);
|
||||||
|
if (res.confirm) {
|
||||||
|
plus.cache.clear(function(e) {
|
||||||
|
console.log(e);
|
||||||
|
})
|
||||||
|
this.getCache();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
navtos(){
|
||||||
|
this.$u.route({
|
||||||
|
url:"/pages/messages/list"
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 退出登录
|
||||||
|
loginOut(){
|
||||||
|
this.imService.disconnect()
|
||||||
|
uni.clearStorage();
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: "退出登陆成功!",
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
uni.reLaunch({
|
||||||
|
url:"../login/login"
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 获取个人信息
|
||||||
|
getmyinfo(){
|
||||||
|
let that = this;
|
||||||
|
this.$u.api.getshopinfo({
|
||||||
|
}).then(res => {
|
||||||
|
console.log(res);
|
||||||
|
if (res.errCode != 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.info = res.data.memberInfo
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
toOthersPage(url) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/user/' + url
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 打开发布弹窗
|
||||||
|
publish() {
|
||||||
|
this.publishstate = true;
|
||||||
|
},
|
||||||
|
// 关闭发布弹窗
|
||||||
|
close() {
|
||||||
|
this.publishstate = false;
|
||||||
|
},
|
||||||
|
// 跳转发布页面
|
||||||
|
navto(url) {
|
||||||
|
// // 判断直播权限
|
||||||
|
// if(url=="release/tosign"){
|
||||||
|
// this.$u.api.canlive({}).then(res => {
|
||||||
|
// console.log(JSON.stringify(res));
|
||||||
|
// if (res.errCode != 0) {
|
||||||
|
// this.$refs.uToast.show({
|
||||||
|
// title: res.message,
|
||||||
|
// type: 'error'
|
||||||
|
// });
|
||||||
|
// } else {
|
||||||
|
// if(res.data.live_stataes==0){
|
||||||
|
// this.$u.route({
|
||||||
|
// url: `/pages/${url}`
|
||||||
|
// });
|
||||||
|
// }else{
|
||||||
|
// this.$refs.uToast.show({
|
||||||
|
// title: "当前用户没有直播权限",
|
||||||
|
// type: 'error'
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }else{
|
||||||
|
this.$u.route({
|
||||||
|
url: `/pages/${url}`
|
||||||
|
});
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.release-btn {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 475rpx;
|
||||||
|
right: 30rpx;
|
||||||
|
width: 100rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
background: rgba(255, 120, 15, 1);
|
||||||
|
box-shadow: 0rpx 6rpx 6rpx 0rpx rgba(255, 120, 15, 0.22);
|
||||||
|
border-radius: 50%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
> image {
|
||||||
|
width: 36rpx;
|
||||||
|
height: 36rpx;
|
||||||
|
flex-shrink: 0;
|
||||||
|
margin-bottom: 2rpx;
|
||||||
|
}
|
||||||
|
.text {
|
||||||
|
font-size: 20rpx;
|
||||||
|
color: rgba(255, 255, 255, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.publish {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding: 50rpx 84rpx 31rpx 78rpx;
|
||||||
|
image {
|
||||||
|
}
|
||||||
|
.list {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
width: 100%;
|
||||||
|
> view {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
> image {
|
||||||
|
width: 94rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
}
|
||||||
|
> text {
|
||||||
|
margin-top: 10rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.off {
|
||||||
|
margin-top: 81rpx;
|
||||||
|
width: 37rpx;
|
||||||
|
height: 37rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.user{
|
||||||
|
min-height: calc(100vh - var(--window-top));
|
||||||
|
background: #ececec;
|
||||||
|
.head{
|
||||||
|
width: 100%;
|
||||||
|
height: 220rpx;
|
||||||
|
background-color: #FF780F;
|
||||||
|
padding: 0 30rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
.info{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
>image{
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 110rpx;
|
||||||
|
height: 110rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
.name{
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #fff;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
margin-left: 26rpx;
|
||||||
|
>text{
|
||||||
|
margin-top: 14rpx;
|
||||||
|
}
|
||||||
|
>text:first-child{
|
||||||
|
font-size: 28rpx;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
>image{
|
||||||
|
width: 12rpx;
|
||||||
|
height: 20rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.nav{
|
||||||
|
width: 100%;
|
||||||
|
height: 100rpx;
|
||||||
|
display: flex;
|
||||||
|
padding: 30rpx;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
font-size: 30rpx;
|
||||||
|
margin-bottom: 2rpx;
|
||||||
|
color:#333;
|
||||||
|
background-color: #fff;
|
||||||
|
>image{
|
||||||
|
width: 13rpx;
|
||||||
|
height: 25rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -15,7 +15,8 @@
|
|||||||
</u-form>
|
</u-form>
|
||||||
</view>
|
</view>
|
||||||
<text class="tips">密码必须是8-16位,至少含数字/字母/字符两种组合</text>
|
<text class="tips">密码必须是8-16位,至少含数字/字母/字符两种组合</text>
|
||||||
<view class="btn">确定</view>
|
<view class="btn" @click="update">确定</view>
|
||||||
|
<u-toast ref="uToast" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
@@ -28,6 +29,29 @@ export default {
|
|||||||
rePassword: ''
|
rePassword: ''
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
update(){
|
||||||
|
let that = this;
|
||||||
|
this.$u.api.editpassword({
|
||||||
|
old_password:that.model.password,
|
||||||
|
password:that.model.newPassword,
|
||||||
|
repassword:that.model.rePassword
|
||||||
|
}).then(res => {
|
||||||
|
console.log(res);
|
||||||
|
if (res.errCode != 0) {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.message,
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
BIN
static/bg.png
Normal file
|
After Width: | Height: | Size: 341 KiB |
276
static/chatservice.js
Normal file
@@ -0,0 +1,276 @@
|
|||||||
|
/*
|
||||||
|
* @Author: jack.lu
|
||||||
|
* @Date: 2020-4-21 10:10:20
|
||||||
|
* @Last Modified by: jack.lu
|
||||||
|
* @Last Modified time: 2020-4-21 15:01:41
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import GoEasyIM from './goeasy-im-1.0.9.js'
|
||||||
|
|
||||||
|
//用户
|
||||||
|
function User(id, nickname, avatar) {
|
||||||
|
this.id = id;
|
||||||
|
this.nickname = nickname;
|
||||||
|
this.avatar = avatar;
|
||||||
|
}
|
||||||
|
|
||||||
|
//消息
|
||||||
|
function Message(senderUserId, senderNickname, content, type) {
|
||||||
|
this.senderNickname = senderNickname;
|
||||||
|
this.senderUserId = senderUserId;
|
||||||
|
this.content = content;
|
||||||
|
this.type = type
|
||||||
|
}
|
||||||
|
|
||||||
|
//聊天室
|
||||||
|
function Room(id, name, currentUser) {
|
||||||
|
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.currentUser = currentUser;
|
||||||
|
|
||||||
|
this.onlineUsers = {
|
||||||
|
count: 0,
|
||||||
|
users: []
|
||||||
|
};
|
||||||
|
|
||||||
|
this.messages = [];
|
||||||
|
|
||||||
|
this.MessageType = {
|
||||||
|
CHAT: 0,//文字聊天
|
||||||
|
PROP: 1//道具
|
||||||
|
};
|
||||||
|
|
||||||
|
this.Prop = {
|
||||||
|
HEART: 0,//桃心
|
||||||
|
ROCKET: 1//火箭
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function ChatRoomService(room, user) {
|
||||||
|
this.room = new Room(room.id, room.name, user);
|
||||||
|
this.whenNewMessage = function () {
|
||||||
|
|
||||||
|
};
|
||||||
|
this.whenOnlineUserChange = function () {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取实例
|
||||||
|
ChatRoomService.prototype.connectGoEasyIM = function () {
|
||||||
|
this.im = GoEasyIM.getInstance({
|
||||||
|
appkey: 'BC-d9b5e639006b4ee2a4bc9eddc4235a6a',
|
||||||
|
host: 'hangzhou.goeasy.io'
|
||||||
|
});
|
||||||
|
|
||||||
|
//监听网络连接成功
|
||||||
|
this.im.on(GoEasyIM.EVENT.CONNECTED, () => {
|
||||||
|
console.log('GoEasyIM网络连接成功');
|
||||||
|
//连接成功后,更新在线用户数和用户头像
|
||||||
|
this.initialOnlineUsers(this.room.id);
|
||||||
|
});
|
||||||
|
|
||||||
|
//监听网络连接断开
|
||||||
|
this.im.on(GoEasyIM.EVENT.DISCONNECTED, () => {
|
||||||
|
console.log('GoEasyIM网络断开')
|
||||||
|
});
|
||||||
|
|
||||||
|
//监听上下线提醒
|
||||||
|
this.listenerGroupPresence();
|
||||||
|
|
||||||
|
//监听新消息
|
||||||
|
this.listenerNewMessage();
|
||||||
|
|
||||||
|
var currentUser = this.room.currentUser;
|
||||||
|
//连接GoEasyIM
|
||||||
|
this.im.connect({
|
||||||
|
id: currentUser.id,
|
||||||
|
data: {
|
||||||
|
avatar: currentUser.avatar,
|
||||||
|
nickname: currentUser.nickname
|
||||||
|
}
|
||||||
|
}).then(() => {
|
||||||
|
console.log('连接成功');
|
||||||
|
this.initialChatHistory(this.room.id);
|
||||||
|
|
||||||
|
//订阅用户上下线事件
|
||||||
|
this.subscribePresence(this.room.id);
|
||||||
|
//订阅聊天室消息
|
||||||
|
this.subscribeRoomMessage(this.room.id);
|
||||||
|
|
||||||
|
|
||||||
|
}).catch(e => {
|
||||||
|
console.log(e);
|
||||||
|
console.log('连接失败');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
ChatRoomService.prototype.initialWhenNewMessage = function (whenNewMessage) {
|
||||||
|
this.whenNewMessage = whenNewMessage;
|
||||||
|
};
|
||||||
|
|
||||||
|
ChatRoomService.prototype.initialWhenOnlineUserChange = function (whenOnlineUserChange) {
|
||||||
|
this.whenOnlineUserChange = whenOnlineUserChange;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//监听新消息
|
||||||
|
ChatRoomService.prototype.listenerNewMessage = function () {
|
||||||
|
|
||||||
|
this.im.on(GoEasyIM.EVENT.GROUP_MESSAGE_RECEIVED, (message) => {
|
||||||
|
var content = JSON.parse(message.payload.text);
|
||||||
|
this.addNewMessage(message);
|
||||||
|
this.whenNewMessage(content);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
ChatRoomService.prototype.addNewMessage = function (message) {
|
||||||
|
var content = JSON.parse(message.payload.text);
|
||||||
|
let messageContent = "";
|
||||||
|
//聊天消息
|
||||||
|
if (content.type == this.room.MessageType.CHAT) {
|
||||||
|
messageContent = content.content;
|
||||||
|
}
|
||||||
|
//道具消息
|
||||||
|
if (content.type == this.room.MessageType.PROP) {
|
||||||
|
if (content.content == this.room.Prop.ROCKET) {
|
||||||
|
messageContent = "送出了一枚大火箭";
|
||||||
|
}
|
||||||
|
if (content.content == this.room.Prop.HEART) {
|
||||||
|
messageContent = "送出了一个大大的比心";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//添加消息
|
||||||
|
let newMessage = new Message(message.senderId, content.senderNickname, messageContent);
|
||||||
|
this.room.messages.push(newMessage);
|
||||||
|
};
|
||||||
|
|
||||||
|
//监听用户上下线
|
||||||
|
ChatRoomService.prototype.listenerGroupPresence = function () {
|
||||||
|
this.im.on(GoEasyIM.EVENT.GROUP_PRESENCE, (event) => {
|
||||||
|
//更新在线用户数
|
||||||
|
this.room.onlineUsers.count = event.groupOnlineCount;
|
||||||
|
|
||||||
|
if (event.action == 'join' || event.action == 'online') {
|
||||||
|
let userData = JSON.parse(event.userData);
|
||||||
|
//添加新用户
|
||||||
|
let user = new User(event.userId, userData.nickname, userData.avatar);
|
||||||
|
|
||||||
|
//添加在线用户,避免用户重复
|
||||||
|
if (!this.room.onlineUsers.users.find(item => item.id == event.userId)) {
|
||||||
|
this.room.onlineUsers.users.push(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
//添加进入房间的消息
|
||||||
|
let message = new Message(event.userId, userData.nickname, " 进入房间", this.room.MessageType.CHAT);
|
||||||
|
this.room.messages.push(message);
|
||||||
|
} else {
|
||||||
|
let offlineUserIndex = this.room.onlineUsers.users.findIndex(item => item.id == event.userId);
|
||||||
|
if (offlineUserIndex > -1) {
|
||||||
|
//将离开的用户从onlineUsers中删掉
|
||||||
|
let offlineUser = Object.assign(this.room.onlineUsers.users[offlineUserIndex]);
|
||||||
|
this.room.onlineUsers.users.splice(offlineUserIndex, 1);
|
||||||
|
//添加离开消息
|
||||||
|
let message = new Message(offlineUser.id, offlineUser.nickname, " 离开房间", this.room.MessageType.CHAT)
|
||||||
|
this.room.messages.push(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.whenOnlineUserChange(this.room.onlineUsers);
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
//查询和初始化在线用户列表和在线用户数
|
||||||
|
ChatRoomService.prototype.initialOnlineUsers = function (roomId) {
|
||||||
|
let self = this;
|
||||||
|
|
||||||
|
//查询最新上线的用户列表
|
||||||
|
this.im.groupHereNow(roomId)
|
||||||
|
.then(result => {
|
||||||
|
if (result.code == 200) {
|
||||||
|
let users = [];
|
||||||
|
result.content && result.content.map(function (onlineUser) {
|
||||||
|
let userData = JSON.parse(onlineUser.userData);
|
||||||
|
let user = new User(onlineUser.userId, userData.nickname, userData.avatar);
|
||||||
|
users.push(user);
|
||||||
|
});
|
||||||
|
self.room.onlineUsers = {
|
||||||
|
users: users
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}).catch(e => {
|
||||||
|
if (e.code == 401) {
|
||||||
|
console.log("您还没有开通用户在线状态提醒,登录goeasy->我的应用->查看详情->高级功能,自助开通.");
|
||||||
|
} else {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//获取聊天室在线用户数
|
||||||
|
this.im.groupOnlineCount(roomId)
|
||||||
|
.then(result => {
|
||||||
|
this.room.onlineUsers.count = result.content.onlineCount;
|
||||||
|
}).catch(e => {
|
||||||
|
console.log(e)
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
//订阅聊天室成员上下线
|
||||||
|
ChatRoomService.prototype.subscribePresence = function (roomId) {
|
||||||
|
this.im.subscribeGroupPresence([roomId])
|
||||||
|
.then(() => {
|
||||||
|
console.log('成员上下线订阅成功')
|
||||||
|
}).catch(e => {
|
||||||
|
console.log(e)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//订阅聊天室消息
|
||||||
|
ChatRoomService.prototype.subscribeRoomMessage = function (roomId) {
|
||||||
|
this.im.subscribeGroup([roomId])
|
||||||
|
.then(result => {
|
||||||
|
console.log('消息订阅成功')
|
||||||
|
}).catch(e => {
|
||||||
|
console.log(e)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//历史消息
|
||||||
|
ChatRoomService.prototype.initialChatHistory = function (roomId) {
|
||||||
|
var self = this;
|
||||||
|
this.im.history({
|
||||||
|
groupId: roomId
|
||||||
|
}).then(res => {
|
||||||
|
res.content.forEach(function (message) {
|
||||||
|
self.addNewMessage(message);
|
||||||
|
})
|
||||||
|
}).catch(function (error) {
|
||||||
|
if (error.code == 401) {
|
||||||
|
console.log("您还没有开通历史消息的权限,登录goeasy->我的应用->查看详情->高级功能,自助开通.");
|
||||||
|
} else {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
//发送消息
|
||||||
|
ChatRoomService.prototype.sendMessages = function (roomId, content) {
|
||||||
|
var contentMessage = {
|
||||||
|
text: JSON.stringify(content)
|
||||||
|
};
|
||||||
|
let message = this.im.createTextMessage(contentMessage);
|
||||||
|
this.im.sendGroupMessage(roomId, message)
|
||||||
|
.then(() => {
|
||||||
|
console.log('消息发送成功')
|
||||||
|
}).catch(e => {
|
||||||
|
console.log(e);
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
//退出聊天室
|
||||||
|
ChatRoomService.prototype.quitRoom = function (roomId) {
|
||||||
|
this.im.disconnect()
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = ChatRoomService;
|
||||||
2
static/goeasy-im-1.0.9.js
Normal file
BIN
static/image/7.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
static/image/cloneb.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
static/image/close.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
static/image/home/chat.png
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
BIN
static/image/index/close.png
Normal file
|
After Width: | Height: | Size: 753 B |
BIN
static/image/index/live.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
static/image/index/photo.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
static/image/index/publish.png
Normal file
|
After Width: | Height: | Size: 234 B |
BIN
static/image/index/swiper.png
Normal file
|
After Width: | Height: | Size: 280 KiB |
BIN
static/image/index/video.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
static/image/login/safe.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
static/image/menu.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
static/image/shop.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
static/image/shopback.png
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
static/image/tabbar/index.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
static/image/tabbar/indexselect.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
static/image/tabbar/info.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
static/image/tabbar/infoselect.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
static/image/tabbar/mine.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
static/image/tabbar/mineselect.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
static/images/Arrow-Left.png
Normal file
|
After Width: | Height: | Size: 222 B |
BIN
static/images/Avatar-1.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
static/images/Avatar-2.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
static/images/Avatar-3.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
static/images/Avatar-4.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
static/images/GoEasyDemo-Vue-IM-Chat-gif.gif
Normal file
|
After Width: | Height: | Size: 80 KiB |
BIN
static/images/Vector.png
Normal file
|
After Width: | Height: | Size: 714 B |
BIN
static/images/fanzhuan.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
static/images/file-content.png
Normal file
|
After Width: | Height: | Size: 808 B |
BIN
static/images/file-icon.png
Normal file
|
After Width: | Height: | Size: 372 B |
BIN
static/images/file.png
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
BIN
static/images/green-dot.png
Normal file
|
After Width: | Height: | Size: 373 B |
BIN
static/images/group-icon.png
Normal file
|
After Width: | Height: | Size: 502 B |
BIN
static/images/group.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
static/images/im.gif
Normal file
|
After Width: | Height: | Size: 758 KiB |
BIN
static/images/jianpan.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
static/images/loading.gif
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
static/images/logo.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
BIN
static/images/meiyan.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
static/images/pending.gif
Normal file
|
After Width: | Height: | Size: 771 B |
BIN
static/images/play.png
Normal file
|
After Width: | Height: | Size: 560 B |
BIN
static/images/record-appearance-icon.png
Normal file
|
After Width: | Height: | Size: 8.7 KiB |
BIN
static/images/recording-loading.gif
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
static/images/vedio.png
Normal file
|
After Width: | Height: | Size: 8.0 KiB |
956
static/imservice.js
Normal file
@@ -0,0 +1,956 @@
|
|||||||
|
/*
|
||||||
|
* @Author: jack.lu
|
||||||
|
* @Date: 2020-4-21 10:10:20
|
||||||
|
* @Last Modified by: jack.lu
|
||||||
|
* @Last Modified time: 2020-4-21 15:01:41
|
||||||
|
*/
|
||||||
|
|
||||||
|
import GoEasyIM from './goeasy-im-1.0.9';
|
||||||
|
import restApi from './restapi';
|
||||||
|
import music from './music.mp3'
|
||||||
|
|
||||||
|
function Friend(uuid, name, avatar,time = "", text = "",date = "",unReadMessage = 0) {
|
||||||
|
this.uuid = uuid;
|
||||||
|
this.name = name;
|
||||||
|
this.avatar = avatar;
|
||||||
|
this.online = false;
|
||||||
|
this.unReadMessage = parseInt(unReadMessage);
|
||||||
|
this.text = text;
|
||||||
|
this.time = time;
|
||||||
|
this.date = date
|
||||||
|
}
|
||||||
|
|
||||||
|
function Group(uuid, name, avatar) {
|
||||||
|
this.uuid = uuid;
|
||||||
|
this.name = name;
|
||||||
|
this.avatar = avatar;
|
||||||
|
this.unReadMessage = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function CurrentUser(uuid, name, avatar) {
|
||||||
|
this.uuid = uuid;
|
||||||
|
this.name = name;
|
||||||
|
this.avatar = avatar;
|
||||||
|
}
|
||||||
|
|
||||||
|
function IMService() {
|
||||||
|
this.im = GoEasyIM.getInstance({
|
||||||
|
host:'hangzhou.goeasy.io',//qos=1
|
||||||
|
appkey:'BC-d9b5e639006b4ee2a4bc9eddc4235a6a'
|
||||||
|
});
|
||||||
|
//当前“我”
|
||||||
|
this.currentUser = null;
|
||||||
|
//我的好友
|
||||||
|
this.friends = {};
|
||||||
|
this.friendsarr = [];
|
||||||
|
//我的群
|
||||||
|
this.groups = {};
|
||||||
|
//私聊消息记录,map格式,每个好友对应一个数组
|
||||||
|
this.privateMessages = {};
|
||||||
|
|
||||||
|
//群聊消息记录,map格式,每个群对应一个数组
|
||||||
|
this.groupMessages = {};
|
||||||
|
|
||||||
|
this.uid = 0;
|
||||||
|
/*
|
||||||
|
* 监听器们
|
||||||
|
*
|
||||||
|
* 可以在页面里,根据需求,重写以下监听器,
|
||||||
|
* 便于当各种事件触发时,页面能够执行对应的响应
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
//收到一条私聊消息
|
||||||
|
this.onNewPrivateMessageReceive = function (friendId, message) {};
|
||||||
|
//完成一次私聊历史加载
|
||||||
|
this.onPrivateHistoryLoad = function (friendId, messages) {};
|
||||||
|
//收到一条群聊消息
|
||||||
|
this.onNewGroupMessageReceive = function (groupId, message) {};
|
||||||
|
//完成一次群聊历史加载
|
||||||
|
this.onGroupHistoryLoad = function (groupId, messages) {};
|
||||||
|
//好友列表发生改变
|
||||||
|
this.onFriendListChange = function (friends) {};
|
||||||
|
//群列表发生改变
|
||||||
|
this.onGroupListChange = function (groups) {};
|
||||||
|
|
||||||
|
this.whenNewMessage = function () {
|
||||||
|
|
||||||
|
};
|
||||||
|
this.whenOnlineUserChange = function () {
|
||||||
|
|
||||||
|
};
|
||||||
|
this.warrings = function() {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//登录
|
||||||
|
IMService.prototype.login = function (uuid, name, avatar) {
|
||||||
|
//初始化当前用户
|
||||||
|
this.currentUser = new CurrentUser(uuid, name, avatar);
|
||||||
|
//初始化联系人信息,包括群
|
||||||
|
this.initialContacts();
|
||||||
|
return true;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//初始化联系人信息
|
||||||
|
IMService.prototype.initialContacts = function (friendList) {
|
||||||
|
//查询并初始化好友信息
|
||||||
|
// let friendList = restApi.findFriends(this.currentUser);
|
||||||
|
let value = uni.getStorageSync('imlist');
|
||||||
|
console.log(value)
|
||||||
|
if(value != undefined && !value){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
value = JSON.parse(value)
|
||||||
|
let that = this
|
||||||
|
console.log(value)
|
||||||
|
for(let i of value){
|
||||||
|
const token = uni.getStorageSync('token');
|
||||||
|
console.log(token)
|
||||||
|
uni.request({
|
||||||
|
url:"https://mall.dmygkeji.com/api/Specialci/getAtwillUserInfo",
|
||||||
|
data:{
|
||||||
|
userId:i[0]
|
||||||
|
},
|
||||||
|
method:"POST",
|
||||||
|
header:{
|
||||||
|
"Authorization" : 'Bearer' + " " + token
|
||||||
|
},
|
||||||
|
success(res){
|
||||||
|
console.log(res)
|
||||||
|
that.friends[i[0]] = new Friend(res.data.data.member_id, res.data.data.member_nickname, res.data.data.member_avatar,i[1],i[2],i[3]);
|
||||||
|
console.log(that.friends)
|
||||||
|
let sorts = function (friends){
|
||||||
|
let paixu = function (a,b){
|
||||||
|
if(a.date > b.date && b.unReadMessage == 0){
|
||||||
|
return 0;
|
||||||
|
}else{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
friends.sort(paixu)
|
||||||
|
|
||||||
|
}
|
||||||
|
that.friendsarr = []
|
||||||
|
for(let i in that.friends){
|
||||||
|
console.log(i)
|
||||||
|
that.friendsarr.push(that.friends[i])
|
||||||
|
}
|
||||||
|
sorts(that.friendsarr)
|
||||||
|
console.log("历史记录")
|
||||||
|
that.onFriendListChange(that.friends);
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//将用户列表初始化为一个map,便于后续根据friendId得到friend
|
||||||
|
// friendList.map(friend => {
|
||||||
|
// this.friends[friend.uuid] = new Friend(friend.uuid, friend.name, friend.avatar);
|
||||||
|
// });
|
||||||
|
|
||||||
|
//查询并初始化与自己相关的群信息
|
||||||
|
// let groupList = restApi.findGroups(this.currentUser);
|
||||||
|
|
||||||
|
// //将群列表初始化为一个map,方便后续根据groupId索引
|
||||||
|
// groupList.map(group => {
|
||||||
|
// this.groups[group.uuid] = new Group(group.uuid, group.name, group.avatar);
|
||||||
|
// });
|
||||||
|
};
|
||||||
|
|
||||||
|
//获取群成员
|
||||||
|
IMService.prototype.getGroupMembers = function (groupId) {
|
||||||
|
let members = restApi.findGroupMembers(groupId);
|
||||||
|
let membersMap = {};
|
||||||
|
members.map(item => {
|
||||||
|
membersMap[item.uuid] = item
|
||||||
|
});
|
||||||
|
return membersMap;
|
||||||
|
};
|
||||||
|
|
||||||
|
IMService.prototype.getGroupMessages = function (groupId) {
|
||||||
|
if (!this.groupMessages[groupId]) {
|
||||||
|
this.groupMessages[groupId] = {
|
||||||
|
sentMessages:[],
|
||||||
|
pendingMessages:[]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return this.groupMessages[groupId]
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
IMService.prototype.getPrivateMessages = function (friendId) {
|
||||||
|
if (!this.privateMessages[friendId]) {
|
||||||
|
this.privateMessages[friendId] = {
|
||||||
|
sentMessages:[],
|
||||||
|
pendingMessages:[]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return this.privateMessages[friendId]
|
||||||
|
};
|
||||||
|
|
||||||
|
//重置群聊未读消息
|
||||||
|
IMService.prototype.resetGroupUnReadMessage = function (group) {
|
||||||
|
this.groups[group.uuid].unReadMessage = 0;
|
||||||
|
this.onGroupListChange(this.groups);
|
||||||
|
};
|
||||||
|
|
||||||
|
//将好友的未读消息数字清零
|
||||||
|
IMService.prototype.resetFriendUnReadMessage = function (friend) {
|
||||||
|
if(friend && friend.uuid){
|
||||||
|
this.friends[friend.uuid].unReadMessage = 0;
|
||||||
|
}
|
||||||
|
this.onFriendListChange(this.friends);
|
||||||
|
};
|
||||||
|
|
||||||
|
//连接GoEasy
|
||||||
|
IMService.prototype.connectIM = function () {
|
||||||
|
//初始化IM相关的监听器
|
||||||
|
try {
|
||||||
|
this.initialIMListeners();
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.log(123)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
this.im.connect({
|
||||||
|
id: this.currentUser.uuid,
|
||||||
|
data: {
|
||||||
|
avatar: this.currentUser.avatar,
|
||||||
|
name: this.currentUser.name
|
||||||
|
}
|
||||||
|
}).then(() => {
|
||||||
|
console.log('连接成功')
|
||||||
|
//订阅与自己相关的群信息
|
||||||
|
this.subscribeGroupMessage();
|
||||||
|
//初始化好友们的在线状态
|
||||||
|
this.initialFriendOnlineStatus();
|
||||||
|
//订阅我的好友们的上下线信息
|
||||||
|
this.subscribeFriendsPresence();
|
||||||
|
}).catch(error => {
|
||||||
|
console.log('连接失败,请确保网络正常,appkey和host正确,code:' + error.code + " content:" + error.content);
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log(12323)
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//IM监听
|
||||||
|
IMService.prototype.initialIMListeners = function () {
|
||||||
|
this.im.on(GoEasyIM.EVENT.CONNECTED, () => {
|
||||||
|
console.log('连接成功.')
|
||||||
|
});
|
||||||
|
|
||||||
|
this.im.on(GoEasyIM.EVENT.DISCONNECTED, () => {
|
||||||
|
console.log('连接断开.')
|
||||||
|
});
|
||||||
|
|
||||||
|
//监听好友上下线
|
||||||
|
this.im.on(GoEasyIM.EVENT.USER_PRESENCE, (user) => {
|
||||||
|
console.log(user)
|
||||||
|
//更新好友在线状态
|
||||||
|
let onlineStatus = user.action == 'online' ? true : false;
|
||||||
|
let friend = this.friends[user.userId];
|
||||||
|
friend.online = onlineStatus;
|
||||||
|
|
||||||
|
//如果页面传入了相应的listener,执行listener
|
||||||
|
this.onFriendListChange(this.friends);
|
||||||
|
});
|
||||||
|
|
||||||
|
//监听私聊消息
|
||||||
|
this.im.on(GoEasyIM.EVENT.PRIVATE_MESSAGE_RECEIVED, (message) => {
|
||||||
|
console.log(message)
|
||||||
|
if(message.senderId == 0){
|
||||||
|
console.log(message.payload.text)
|
||||||
|
this.warrings(JSON.parse(message.payload.text))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//如果不是自己发的,朋友未读消息数 +1
|
||||||
|
if (message.senderId != this.currentUser.uuid) {
|
||||||
|
let friend = this.friends[message.senderId];
|
||||||
|
console.log(friend)
|
||||||
|
// return ;
|
||||||
|
let sorts = function (friends){
|
||||||
|
let paixu = function (a,b){
|
||||||
|
if(a.date > b.date && b.unReadMessage == 0){
|
||||||
|
return 0;
|
||||||
|
}else{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
friends.sort(paixu)
|
||||||
|
|
||||||
|
}
|
||||||
|
if(message.senderId != this.uid){
|
||||||
|
const innerAudioContext = uni.createInnerAudioContext();
|
||||||
|
innerAudioContext.autoplay = true;
|
||||||
|
innerAudioContext.src = music;
|
||||||
|
innerAudioContext.onPlay(() => {
|
||||||
|
console.log('开始播放');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
let that = this
|
||||||
|
if(!friend && friend == undefined){
|
||||||
|
const token = uni.getStorageSync('token');
|
||||||
|
console.log(token)
|
||||||
|
uni.request({
|
||||||
|
url:"https://mall.dmygkeji.com/api/Specialci/getAtwillUserInfo",
|
||||||
|
data:{
|
||||||
|
userId:message.senderId
|
||||||
|
},
|
||||||
|
method:"POST",
|
||||||
|
header:{
|
||||||
|
"Authorization" : 'Bearer' + " " + token
|
||||||
|
},
|
||||||
|
success(res){
|
||||||
|
console.log(res)
|
||||||
|
that.friends[message.senderId] = new Friend(res.data.data.member_id, res.data.data.member_nickname, res.data.data.member_avatar);
|
||||||
|
friend = that.friends[message.senderId];
|
||||||
|
console.log(friend)
|
||||||
|
friend.unReadMessage++;
|
||||||
|
friend.text = message.type != "text" ? "其他消息" : message.payload.text
|
||||||
|
let time = new Date(message.timestamp)
|
||||||
|
friend.date = message.timestamp
|
||||||
|
friend.time = (time.getHours() < 10 ? '0' + time.getHours() : time.getHours()) + ":" + (time.getMinutes() < 10 ? '0' + time.getMinutes() : time.getMinutes()) + ":" + (time.getSeconds() < 10 ? '0' + time.getSeconds() : time.getSeconds())
|
||||||
|
|
||||||
|
console.log(that.friends)
|
||||||
|
that.friendsarr = []
|
||||||
|
for(let i in that.friends){
|
||||||
|
console.log(i)
|
||||||
|
that.friendsarr.push(that.friends[i])
|
||||||
|
}
|
||||||
|
sorts(that.friendsarr)
|
||||||
|
let arr = []
|
||||||
|
for(let i in that.friends){
|
||||||
|
arr.push([that.friends[i].uuid,that.friends[i].time,that.friends[i].text,that.friends[i].date,that.friends[i].unReadMessage])
|
||||||
|
}
|
||||||
|
console.log(arr)
|
||||||
|
uni.setStorageSync('imlist',JSON.stringify(arr))
|
||||||
|
let value = uni.getStorageSync('imlist');
|
||||||
|
console.log(value)
|
||||||
|
that.onFriendListChange(that.friends);
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
console.log(friend)
|
||||||
|
friend.unReadMessage++;
|
||||||
|
friend.text = message.type != "text" ? "其他消息" : message.payload.text
|
||||||
|
let time = new Date(message.timestamp)
|
||||||
|
friend.date = message.timestamp
|
||||||
|
friend.time = (time.getHours() < 10 ? '0' + time.getHours() : time.getHours()) + ":" + (time.getMinutes() < 10 ? '0' + time.getMinutes() : time.getMinutes()) + ":" + (time.getSeconds() < 10 ? '0' + time.getSeconds() : time.getSeconds())
|
||||||
|
|
||||||
|
console.log(this.friends)
|
||||||
|
that.friendsarr = []
|
||||||
|
for(let i in this.friends){
|
||||||
|
that.friendsarr.push(this.friends[i])
|
||||||
|
}
|
||||||
|
sorts(that.friendsarr)
|
||||||
|
let arr = []
|
||||||
|
for(let i in that.friends){
|
||||||
|
arr.push([that.friends[i].uuid,that.friends[i].time,that.friends[i].text,that.friends[i].date,that.friends[i].unReadMessage])
|
||||||
|
}
|
||||||
|
console.log(arr)
|
||||||
|
uni.setStorageSync('imlist',JSON.stringify(arr))
|
||||||
|
let value = uni.getStorageSync('imlist');
|
||||||
|
console.log(value)
|
||||||
|
this.onFriendListChange(this.friends);
|
||||||
|
|
||||||
|
}
|
||||||
|
// let value = uni.getStorageSync('imlist');
|
||||||
|
// value = JSON.parse(value)
|
||||||
|
// if(value.indexOf(message.senderId) == -1){
|
||||||
|
// value.unshift(message.senderId)
|
||||||
|
// }
|
||||||
|
// uni.setStorageSync('imlist',JSON.stringify(value))
|
||||||
|
|
||||||
|
}
|
||||||
|
//更新私聊消息记录
|
||||||
|
let friendId;
|
||||||
|
if (this.currentUser.uuid == message.senderId) {
|
||||||
|
friendId = message.receiverId;
|
||||||
|
} else {
|
||||||
|
friendId = message.senderId;
|
||||||
|
}
|
||||||
|
removePrivatePendingMessage(this, friendId, message);
|
||||||
|
|
||||||
|
let friendMessages = this.getPrivateMessages(friendId);
|
||||||
|
friendMessages.sentMessages.push(message);
|
||||||
|
|
||||||
|
//如果页面传入了相应的listener,执行listener
|
||||||
|
this.onNewPrivateMessageReceive(friendId, message);
|
||||||
|
});
|
||||||
|
|
||||||
|
// //监听群聊消息
|
||||||
|
// this.im.on(GoEasyIM.EVENT.GROUP_MESSAGE_RECEIVED, (message) => {
|
||||||
|
// let groupId = message.groupId;
|
||||||
|
// //群未读消息+1
|
||||||
|
// let group = this.groups[groupId];
|
||||||
|
// group.unReadMessage++;
|
||||||
|
// removeGroupPendingMessage(this, groupId, message);
|
||||||
|
// //如果页面传入了相应的listener,执行listener
|
||||||
|
// this.onGroupListChange(this.groups);
|
||||||
|
|
||||||
|
// //更新群聊消息记录
|
||||||
|
// let groupMessages = this.getGroupMessages(groupId);
|
||||||
|
// let sentMessages = groupMessages.sentMessages;
|
||||||
|
// sentMessages.push(message);
|
||||||
|
// //如果页面传入了相应的listener,执行listener
|
||||||
|
// this.onNewGroupMessageReceive(groupId, message);
|
||||||
|
// })
|
||||||
|
};
|
||||||
|
|
||||||
|
IMService.prototype.sendMessagesSetStorage = function (friendId,message){
|
||||||
|
let friend = this.friends[friendId];
|
||||||
|
console.log(friend)
|
||||||
|
// return ;
|
||||||
|
let sorts = function (friends){
|
||||||
|
let paixu = function (a,b){
|
||||||
|
if(a.date > b.date && b.unReadMessage == 0){
|
||||||
|
return 0;
|
||||||
|
}else{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
friends.sort(paixu)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
let that = this
|
||||||
|
if(!friend && friend == undefined){
|
||||||
|
const token = uni.getStorageSync('token');
|
||||||
|
console.log(token)
|
||||||
|
uni.request({
|
||||||
|
url:"https://mall.dmygkeji.com/api/Specialci/getAtwillUserInfo",
|
||||||
|
data:{
|
||||||
|
userId:friendId
|
||||||
|
},
|
||||||
|
method:"POST",
|
||||||
|
header:{
|
||||||
|
"Authorization" : 'Bearer' + " " + token
|
||||||
|
},
|
||||||
|
success(res){
|
||||||
|
console.log(res)
|
||||||
|
that.friends[friendId] = new Friend(res.data.data.member_id, res.data.data.member_nickname, res.data.data.member_avatar);
|
||||||
|
friend = that.friends[friendId];
|
||||||
|
console.log(friend)
|
||||||
|
friend.text = message
|
||||||
|
let time = new Date()
|
||||||
|
friend.date = time.getTime()
|
||||||
|
friend.time = (time.getHours() < 10 ? '0' + time.getHours() : time.getHours()) + ":" + (time.getMinutes() < 10 ? '0' + time.getMinutes() : time.getMinutes()) + ":" + (time.getSeconds() < 10 ? '0' + time.getSeconds() : time.getSeconds())
|
||||||
|
|
||||||
|
console.log(that.friends)
|
||||||
|
that.friendsarr = []
|
||||||
|
for(let i in that.friends){
|
||||||
|
console.log(i)
|
||||||
|
that.friendsarr.push(that.friends[i])
|
||||||
|
}
|
||||||
|
sorts(that.friendsarr)
|
||||||
|
let arr = []
|
||||||
|
for(let i in that.friends){
|
||||||
|
arr.push([that.friends[i].uuid,that.friends[i].time,that.friends[i].text,that.friends[i].date,0])
|
||||||
|
}
|
||||||
|
console.log(arr)
|
||||||
|
uni.setStorageSync('imlist',JSON.stringify(arr))
|
||||||
|
|
||||||
|
that.onFriendListChange(that.friends);
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
console.log(friend)
|
||||||
|
friend.text = message
|
||||||
|
let time = new Date()
|
||||||
|
friend.date = time.getTime()
|
||||||
|
friend.time = (time.getHours() < 10 ? '0' + time.getHours() : time.getHours()) + ":" + (time.getMinutes() < 10 ? '0' + time.getMinutes() : time.getMinutes()) + ":" + (time.getSeconds() < 10 ? '0' + time.getSeconds() : time.getSeconds())
|
||||||
|
|
||||||
|
console.log(this.friends)
|
||||||
|
that.friendsarr = []
|
||||||
|
for(let i in this.friends){
|
||||||
|
that.friendsarr.push(this.friends[i])
|
||||||
|
}
|
||||||
|
sorts(that.friendsarr)
|
||||||
|
let arr = []
|
||||||
|
for(let i in that.friends){
|
||||||
|
arr.push([that.friends[i].uuid,that.friends[i].time,that.friends[i].text,that.friends[i].date,0])
|
||||||
|
}
|
||||||
|
console.log(arr)
|
||||||
|
uni.setStorageSync('imlist',JSON.stringify(arr))
|
||||||
|
this.onFriendListChange(this.friends);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//订阅群消息
|
||||||
|
IMService.prototype.subscribeGroupMessage = function (id) {
|
||||||
|
this.im.subscribeGroup([id])
|
||||||
|
.then(() => {
|
||||||
|
console.log('订阅群消息成功')
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.log('订阅群消息失败')
|
||||||
|
console.log(error)
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
//初始化好友在线状态
|
||||||
|
IMService.prototype.initialFriendOnlineStatus = function () {
|
||||||
|
let friendIds = Object.keys(this.friends);
|
||||||
|
this.im.hereNow({
|
||||||
|
userIds: friendIds
|
||||||
|
}).then(result => {
|
||||||
|
let onlineFriends = result.content;
|
||||||
|
onlineFriends.map(user => {
|
||||||
|
let friend = this.friends[user.userId];
|
||||||
|
friend.online = true;
|
||||||
|
});
|
||||||
|
this.onFriendListChange(this.friends);
|
||||||
|
}).catch(error => {
|
||||||
|
console.log(error)
|
||||||
|
if (error.code == 401) {
|
||||||
|
console.log("获取在线用户失败,您尚未开通用户在线状态,请登录GoEasy,查看应用详情里自助启用.");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
//监听所有好友上下线
|
||||||
|
IMService.prototype.subscribeFriendsPresence = function () {
|
||||||
|
let friendIds = Object.keys(this.friends);
|
||||||
|
this.im.subscribeUserPresence(friendIds)
|
||||||
|
.then(() => {
|
||||||
|
console.log('监听好友上下线成功')
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.log(error);
|
||||||
|
if (error.code == 401) {
|
||||||
|
console.log("监听好友上下线失败,您尚未开通用户状态提醒,请登录GoEasy,查看应用详情里自助启用.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
//加载单聊历史消息
|
||||||
|
IMService.prototype.loadPrivateHistoryMessage = function (friendId, timeStamp) {
|
||||||
|
this.im.history({
|
||||||
|
friendId: friendId,
|
||||||
|
lastTimestamp: timeStamp
|
||||||
|
}).then(result => {
|
||||||
|
let history = result.content;
|
||||||
|
let privateMessages = this.getPrivateMessages(friendId);
|
||||||
|
let friendMessages = privateMessages.sentMessages;
|
||||||
|
for (let i = history.length - 1; i >=0; i--) {
|
||||||
|
friendMessages.unshift(history[i])
|
||||||
|
}
|
||||||
|
//如果页面传入了相应的listener,执行listener
|
||||||
|
this.onPrivateHistoryLoad(friendId, history);
|
||||||
|
}).catch(error => {
|
||||||
|
console.log(error);
|
||||||
|
if (error.code == 401) {
|
||||||
|
console.log("您尚未开通历史消息,请登录GoEasy,查看应用详情里自助启用.");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
//发送私聊消息
|
||||||
|
IMService.prototype.sendPrivateTextMessage = function (friendId, text) {
|
||||||
|
let textMessage = this.im.createTextMessage({
|
||||||
|
text: text
|
||||||
|
});
|
||||||
|
this.sendPrivateMessage(friendId, textMessage);
|
||||||
|
this.sendMessagesSetStorage(friendId, text)
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//私聊图片消息
|
||||||
|
IMService.prototype.sendPrivateImageMessage = function (friendId, imageFile) {
|
||||||
|
let imageMessage = this.im.createImageMessage({
|
||||||
|
file: imageFile,
|
||||||
|
onProgress :function (progress) {
|
||||||
|
console.log(progress)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.sendPrivateMessage(friendId, imageMessage);
|
||||||
|
this.sendMessagesSetStorage(friendId, '其他消息')
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//私聊视频消息
|
||||||
|
IMService.prototype.sendPrivateVideoMessage = function (friendId, videoFile) {
|
||||||
|
let videoMessage = this.im.createVideoMessage({
|
||||||
|
file: videoFile,
|
||||||
|
onProgress :function (progress) {
|
||||||
|
console.log(progress)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.sendPrivateMessage(friendId, videoMessage);
|
||||||
|
this.sendMessagesSetStorage(friendId, '其他消息')
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
IMService.prototype.sendPrivateAudioMessage = function (friendId, audiofile) {
|
||||||
|
let audioMessage = this.im.createAudioMessage({
|
||||||
|
file: audiofile,
|
||||||
|
onProgress :function (progress) {
|
||||||
|
console.log(progress)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.sendPrivateMessage(friendId, audioMessage);
|
||||||
|
this.sendMessagesSetStorage(friendId, '其他消息')
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//发送私聊消息
|
||||||
|
IMService.prototype.sendPrivateMessage = function (friendId, message) {
|
||||||
|
|
||||||
|
//加入pendingMessage列表,成功后将会被挪除
|
||||||
|
let privateMessages = this.getPrivateMessages(friendId);
|
||||||
|
privateMessages.pendingMessages.push(message);
|
||||||
|
|
||||||
|
//发送
|
||||||
|
this.im.sendPrivateMessage(friendId, message)
|
||||||
|
.then((res) => {
|
||||||
|
console.log(res)
|
||||||
|
})
|
||||||
|
.catch(e => {
|
||||||
|
console.log(e)
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
//发送群聊消息
|
||||||
|
IMService.prototype.sendGroupTextMessage = function (groupId, message) {
|
||||||
|
let textMessage = this.im.createTextMessage({
|
||||||
|
text:message
|
||||||
|
});
|
||||||
|
this.sendGroupMessage(groupId, textMessage);
|
||||||
|
};
|
||||||
|
//私聊图片消息
|
||||||
|
IMService.prototype.sendGroupImageMessage = function (groupId, imageFile) {
|
||||||
|
let imageMessage = this.im.createImageMessage({
|
||||||
|
file: imageFile,
|
||||||
|
onProgress :function (progress) {
|
||||||
|
console.log(progress)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.sendGroupMessage(groupId, imageMessage);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//私聊视频消息
|
||||||
|
IMService.prototype.sendGroupVideoMessage = function (groupId, videoFile) {
|
||||||
|
let videoMessage = this.im.createVideoMessage({
|
||||||
|
file: videoFile,
|
||||||
|
onProgress :function (progress) {
|
||||||
|
console.log(progress)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.sendGroupMessage(groupId, videoMessage);
|
||||||
|
};
|
||||||
|
|
||||||
|
IMService.prototype.sendGroupAudioMessage = function (groupId, audioFile) {
|
||||||
|
let audioMessage = this.im.createAudioMessage({
|
||||||
|
file: audioFile,
|
||||||
|
onProgress :function (progress) {
|
||||||
|
console.log(progress)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.sendGroupMessage(groupId, audioMessage);
|
||||||
|
};
|
||||||
|
|
||||||
|
IMService.prototype.sendGroupMessage =function(groupId, groupMessage) {
|
||||||
|
//先放入Pending列表,待成功后挪除
|
||||||
|
let groupMessages = this.getGroupMessages(groupId);
|
||||||
|
let pendingMessages = groupMessages.pendingMessages;
|
||||||
|
pendingMessages.push(groupMessage)
|
||||||
|
|
||||||
|
this.im.sendGroupMessage(groupId, groupMessage)
|
||||||
|
.then((res) => {
|
||||||
|
console.log(res)
|
||||||
|
})
|
||||||
|
.catch(e => {
|
||||||
|
console.log(e)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//群聊历史消息
|
||||||
|
IMService.prototype.loadGroupHistoryMessage = function (groupId, timeStamp) {
|
||||||
|
this.im.history({
|
||||||
|
groupId: groupId,
|
||||||
|
lastTimestamp: timeStamp
|
||||||
|
}).then(result => {
|
||||||
|
let history = result.content;
|
||||||
|
let groupMessages = this.getGroupMessages(groupId);
|
||||||
|
let sentGroupMessages = groupMessages.sentMessages;
|
||||||
|
for (let i = history.length - 1; i >= 0; i--) {
|
||||||
|
sentGroupMessages.unshift(history[i]);
|
||||||
|
}
|
||||||
|
this.onGroupHistoryLoad(groupId, history);
|
||||||
|
}).catch(error => {
|
||||||
|
console.log(error)
|
||||||
|
if (error.code == 401) {
|
||||||
|
console.log("您尚未开通历史消息,请登录GoEasy,查看应用详情里自助启用.");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
IMService.prototype.disconnect = function () {
|
||||||
|
this.im.disconnect()
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
function removePrivatePendingMessage(imService,friendId, message){
|
||||||
|
let privateMessages = imService.getPrivateMessages(friendId);
|
||||||
|
let pendingMessages = privateMessages.pendingMessages;
|
||||||
|
let pendingMessageIndex = pendingMessages.findIndex(item => item.messageId == message.messageId);
|
||||||
|
if(pendingMessageIndex > -1) {
|
||||||
|
pendingMessages.splice(pendingMessageIndex,1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function removeGroupPendingMessage(imService,groupId, message){
|
||||||
|
let groupMessages = imService.getGroupMessages(groupId);
|
||||||
|
let pendingMessages = groupMessages.pendingMessages;
|
||||||
|
let pendingMessageIndex = pendingMessages.findIndex(item => item.messageId == message.messageId);
|
||||||
|
if(pendingMessageIndex > -1) {
|
||||||
|
pendingMessages.splice(pendingMessageIndex,1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//下面是合并的
|
||||||
|
|
||||||
|
|
||||||
|
//用户
|
||||||
|
function User(id, nickname, avatar) {
|
||||||
|
this.id = id;
|
||||||
|
this.nickname = nickname;
|
||||||
|
this.avatar = avatar;
|
||||||
|
}
|
||||||
|
|
||||||
|
//消息
|
||||||
|
function Message(senderUserId, senderNickname, content, type) {
|
||||||
|
this.senderNickname = senderNickname;
|
||||||
|
this.senderUserId = senderUserId;
|
||||||
|
this.content = content;
|
||||||
|
this.type = type
|
||||||
|
}
|
||||||
|
|
||||||
|
//聊天室
|
||||||
|
function Room(id, name, currentUser) {
|
||||||
|
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.currentUser = currentUser;
|
||||||
|
|
||||||
|
this.onlineUsers = {
|
||||||
|
count: 0,
|
||||||
|
users: []
|
||||||
|
};
|
||||||
|
|
||||||
|
this.messages = [];
|
||||||
|
|
||||||
|
this.MessageType = {
|
||||||
|
CHAT: 0,//文字聊天
|
||||||
|
PROP: 1//道具
|
||||||
|
};
|
||||||
|
|
||||||
|
this.Prop = {
|
||||||
|
HEART: 0,//桃心
|
||||||
|
ROCKET: 1//火箭
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
IMService.prototype.initialWhenNewMessage = function (whenNewMessage) {
|
||||||
|
this.whenNewMessage = whenNewMessage;
|
||||||
|
};
|
||||||
|
|
||||||
|
IMService.prototype.initialWhenOnlineUserChange = function (whenOnlineUserChange) {
|
||||||
|
this.whenOnlineUserChange = whenOnlineUserChange;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//监听新消息
|
||||||
|
IMService.prototype.listenerNewMessage = function () {
|
||||||
|
|
||||||
|
this.im.on(GoEasyIM.EVENT.GROUP_MESSAGE_RECEIVED, (message) => {
|
||||||
|
console.log(message)
|
||||||
|
if(message.senderId == 0){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
var content = JSON.parse(message.payload.text);
|
||||||
|
this.addNewMessage(message);
|
||||||
|
this.whenNewMessage(content);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
IMService.prototype.addNewMessage = function (message) {
|
||||||
|
var content = JSON.parse(message.payload.text);
|
||||||
|
let messageContent = "";
|
||||||
|
//聊天消息
|
||||||
|
if (content.type == this.room.MessageType.CHAT) {
|
||||||
|
messageContent = content.content;
|
||||||
|
}
|
||||||
|
//道具消息
|
||||||
|
if (content.type == this.room.MessageType.PROP) {
|
||||||
|
if (content.content == this.room.Prop.ROCKET) {
|
||||||
|
messageContent = "送出了一枚大火箭";
|
||||||
|
}
|
||||||
|
if (content.content == this.room.Prop.HEART) {
|
||||||
|
messageContent = "送出了一个大大的比心";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//添加消息
|
||||||
|
let newMessage = new Message(message.senderId, content.senderNickname, messageContent);
|
||||||
|
this.room.messages.push(newMessage);
|
||||||
|
};
|
||||||
|
|
||||||
|
//监听用户上下线
|
||||||
|
IMService.prototype.listenerGroupPresence = function () {
|
||||||
|
this.im.on(GoEasyIM.EVENT.GROUP_PRESENCE, (event) => {
|
||||||
|
//更新在线用户数
|
||||||
|
this.room.onlineUsers.count = event.groupOnlineCount;
|
||||||
|
|
||||||
|
if (event.action == 'join' || event.action == 'online') {
|
||||||
|
let userData = JSON.parse(event.userData);
|
||||||
|
//添加新用户
|
||||||
|
let user = new User(event.userId, userData.nickname, userData.avatar);
|
||||||
|
|
||||||
|
//添加在线用户,避免用户重复
|
||||||
|
if (!this.room.onlineUsers.users.find(item => item.id == event.userId)) {
|
||||||
|
this.room.onlineUsers.users.push(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
//添加进入房间的消息
|
||||||
|
let message = new Message(event.userId, userData.nickname, " 进入房间", this.room.MessageType.CHAT);
|
||||||
|
this.room.messages.push(message);
|
||||||
|
} else {
|
||||||
|
let offlineUserIndex = this.room.onlineUsers.users.findIndex(item => item.id == event.userId);
|
||||||
|
if (offlineUserIndex > -1) {
|
||||||
|
//将离开的用户从onlineUsers中删掉
|
||||||
|
let offlineUser = Object.assign(this.room.onlineUsers.users[offlineUserIndex]);
|
||||||
|
this.room.onlineUsers.users.splice(offlineUserIndex, 1);
|
||||||
|
//添加离开消息
|
||||||
|
let message = new Message(offlineUser.id, offlineUser.nickname, " 离开房间", this.room.MessageType.CHAT)
|
||||||
|
this.room.messages.push(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.whenOnlineUserChange(this.room.onlineUsers);
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
//查询和初始化在线用户列表和在线用户数
|
||||||
|
IMService.prototype.initialOnlineUsers = function (roomId) {
|
||||||
|
let self = this;
|
||||||
|
|
||||||
|
//查询最新上线的用户列表
|
||||||
|
this.im.groupHereNow(roomId)
|
||||||
|
.then(result => {
|
||||||
|
if (result.code == 200) {
|
||||||
|
let users = [];
|
||||||
|
result.content && result.content.map(function (onlineUser) {
|
||||||
|
let userData = JSON.parse(onlineUser.userData);
|
||||||
|
let user = new User(onlineUser.userId, userData.nickname, userData.avatar);
|
||||||
|
users.push(user);
|
||||||
|
});
|
||||||
|
self.room.onlineUsers = {
|
||||||
|
users: users
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}).catch(e => {
|
||||||
|
if (e.code == 401) {
|
||||||
|
console.log("您还没有开通用户在线状态提醒,登录goeasy->我的应用->查看详情->高级功能,自助开通.");
|
||||||
|
} else {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//获取聊天室在线用户数
|
||||||
|
this.im.groupOnlineCount(roomId)
|
||||||
|
.then(result => {
|
||||||
|
this.room.onlineUsers.count = result.content.onlineCount;
|
||||||
|
}).catch(e => {
|
||||||
|
console.log(e)
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
//订阅聊天室成员上下线
|
||||||
|
IMService.prototype.subscribePresence = function (roomId) {
|
||||||
|
this.im.subscribeGroupPresence([roomId])
|
||||||
|
.then(() => {
|
||||||
|
console.log('成员上下线订阅成功')
|
||||||
|
}).catch(e => {
|
||||||
|
console.log(e)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//订阅聊天室消息
|
||||||
|
IMService.prototype.subscribeRoomMessage = function (room, user) {
|
||||||
|
this.room = new Room(room.id, room.name, user);
|
||||||
|
|
||||||
|
|
||||||
|
//监听上下线提醒
|
||||||
|
this.listenerGroupPresence();
|
||||||
|
|
||||||
|
//监听新消息
|
||||||
|
this.listenerNewMessage();
|
||||||
|
//订阅用户上下线事件
|
||||||
|
this.subscribePresence(this.room.id);
|
||||||
|
//订阅聊天室消息
|
||||||
|
// this.subscribeRoomMessage(this.room.id);
|
||||||
|
this.im.subscribeGroup([this.room.id])
|
||||||
|
.then(result => {
|
||||||
|
console.log('消息订阅成功')
|
||||||
|
}).catch(e => {
|
||||||
|
console.log(e,'失败')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//历史消息
|
||||||
|
IMService.prototype.initialChatHistory = function (roomId) {
|
||||||
|
var self = this;
|
||||||
|
this.im.history({
|
||||||
|
groupId: roomId
|
||||||
|
}).then(res => {
|
||||||
|
res.content.forEach(function (message) {
|
||||||
|
self.addNewMessage(message);
|
||||||
|
})
|
||||||
|
}).catch(function (error) {
|
||||||
|
if (error.code == 401) {
|
||||||
|
console.log("您还没有开通历史消息的权限,登录goeasy->我的应用->查看详情->高级功能,自助开通.");
|
||||||
|
} else {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
//发送消息
|
||||||
|
IMService.prototype.sendMessages = function (roomId, content) {
|
||||||
|
var contentMessage = {
|
||||||
|
text: JSON.stringify(content)
|
||||||
|
};
|
||||||
|
let message = this.im.createTextMessage(contentMessage);
|
||||||
|
this.im.sendGroupMessage(roomId, message)
|
||||||
|
.then(() => {
|
||||||
|
console.log('消息发送成功')
|
||||||
|
}).catch(e => {
|
||||||
|
console.log(e);
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
//退出聊天室
|
||||||
|
IMService.prototype.quitRoom = function (roomId) {
|
||||||
|
this.im.disconnect()
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export default IMService;
|
||||||
BIN
static/music.mp3
Normal file
79
static/restapi.js
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
//用户数据示例
|
||||||
|
let users = [
|
||||||
|
{
|
||||||
|
"uuid": "08c0a6ec-a42b-47b2-bb1e-15e0f5f9a19a",
|
||||||
|
"name": "Mattie",
|
||||||
|
"password": "123",
|
||||||
|
"avatar": '../../static/images/Avatar-1.png'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uuid": "3bb179af-bcc5-4fe0-9dac-c05688484649",
|
||||||
|
"name": "Wallace",
|
||||||
|
"password": "123",
|
||||||
|
"avatar": '../../static/images/Avatar-2.png'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uuid": "fdee46b0-4b01-4590-bdba-6586d7617f95",
|
||||||
|
"name": "Tracy",
|
||||||
|
"password": "123",
|
||||||
|
"avatar": '../../static/images/Avatar-3.png'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uuid": "33c3693b-dbb0-4bc9-99c6-fa77b9eb763f",
|
||||||
|
"name": "Juanita",
|
||||||
|
"password": "123",
|
||||||
|
"avatar": '../../static/images/Avatar-4.png'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
//群数据示例
|
||||||
|
let groups = [
|
||||||
|
{
|
||||||
|
"uuid": "group-a42b-47b2-bb1e-15e0f5f9a19a",
|
||||||
|
"name": "群1",
|
||||||
|
"userList": ['08c0a6ec-a42b-47b2-bb1e-15e0f5f9a19a', '3bb179af-bcc5-4fe0-9dac-c05688484649', 'fdee46b0-4b01-4590-bdba-6586d7617f95', '33c3693b-dbb0-4bc9-99c6-fa77b9eb763f']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uuid": "group-4b01-4590-bdba-6586d7617f95",
|
||||||
|
"name": "群2",
|
||||||
|
"userList": ['08c0a6ec-a42b-47b2-bb1e-15e0f5f9a19a', 'fdee46b0-4b01-4590-bdba-6586d7617f95', '33c3693b-dbb0-4bc9-99c6-fa77b9eb763f']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uuid": "group-dbb0-4bc9-99c6-fa77b9eb763f",
|
||||||
|
"name": "群3",
|
||||||
|
"userList": ['08c0a6ec-a42b-47b2-bb1e-15e0f5f9a19a', '3bb179af-bcc5-4fe0-9dac-c05688484649']
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
function RestApi() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
RestApi.prototype.findFriends = function (user) {
|
||||||
|
var friendList = users.filter(v => v.uuid != user.uuid);
|
||||||
|
return friendList;
|
||||||
|
}
|
||||||
|
|
||||||
|
RestApi.prototype.findGroups = function (user) {
|
||||||
|
var groupList = groups.filter(v => v.userList.find(id => id == user.uuid));
|
||||||
|
return groupList;
|
||||||
|
}
|
||||||
|
|
||||||
|
RestApi.prototype.findUser = function (username, password) {
|
||||||
|
var user = users.find(user => (user.name == username && user.password == password))
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
RestApi.prototype.findGroupMembers = function (groupId) {
|
||||||
|
let members = [];
|
||||||
|
let group = groups.find(v => v.uuid == groupId);
|
||||||
|
users.map(user => {
|
||||||
|
if (group.userList.find(v => v == user.uuid)) {
|
||||||
|
members.push(user)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return members;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default new RestApi();
|
||||||
10571
static/rongyun.js
BIN
static/videoPlay.png
Normal file
|
After Width: | Height: | Size: 4.7 KiB |