Przeglądaj źródła

分享bug

master
HolyKnightIX 1 rok temu
rodzic
commit
ab5a7dda97
6 zmienionych plików z 96 dodań i 23 usunięć
  1. +1
    -0
      miniprogram/app.js
  2. +25
    -5
      miniprogram/pages/ContactUs/ContactUs.js
  3. +25
    -5
      miniprogram/pages/chat/chat.js
  4. +42
    -10
      miniprogram/pages/index/index.js
  5. +2
    -2
      miniprogram/utils/request.js
  6. +1
    -1
      project.config.json

+ 1
- 0
miniprogram/app.js Wyświetl plik

@@ -82,6 +82,7 @@ App({

wx.setStorageSync('completionContentCount', res.data.completionContentCount)
that.globalData.completionContentCount = res.data.completionContentCount

}).catch(err => {
console.log(err, 'err');
})


+ 25
- 5
miniprogram/pages/ContactUs/ContactUs.js Wyświetl plik

@@ -48,7 +48,7 @@ Page({
})
},

makePhoneCall(e){
makePhoneCall(e) {
wx.makePhoneCall({
phoneNumber: e.currentTarget.dataset.phone
})
@@ -97,10 +97,30 @@ Page({

},

/**
* 用户点击右上角分享
*/
onShareAppMessage() {

const promise = new Promise(resolve => {
setTimeout(() => {
resolve({
title: '小闲聊'
})
}, 500)
})
return {
title: '小闲聊',
promise
}
},
onShareTimeline() {
const promise = new Promise(resolve => {
setTimeout(() => {
resolve({
title: '小闲聊'
})
}, 500)
})
return {
title: '小闲聊',
promise
}
}
})

+ 25
- 5
miniprogram/pages/chat/chat.js Wyświetl plik

@@ -43,7 +43,7 @@ Page({
const that = this
return new Promise((resolve, reject) => {
const data = {
appId: 'wxf288a9b8167ff2ca',
appId: 'wxedb9fb309728a9f1',
message
}
request.post({
@@ -440,10 +440,30 @@ Page({

},

/**
* 用户点击右上角分享
*/
onShareAppMessage() {

const promise = new Promise(resolve => {
setTimeout(() => {
resolve({
title: '小闲聊'
})
}, 500)
})
return {
title: '小闲聊',
promise
}
},
onShareTimeline() {
const promise = new Promise(resolve => {
setTimeout(() => {
resolve({
title: '小闲聊'
})
}, 500)
})
return {
title: '小闲聊',
promise
}
}
})

+ 42
- 10
miniprogram/pages/index/index.js Wyświetl plik

@@ -29,19 +29,28 @@ Page({
this.checkUserInfo()
}
const that = this
app.userInfoCallback = res => {
console.log(res, 'userInfoCallback')
that.setData({
userInfo: res.data,
isPhone: that.data.userInfo.phone ? true : false
})
if (app.globalData.noticeText) {
if (!this.data.checkUserInfo) {
app.userInfoCallback = res => {
console.log(res, 'userInfoCallback')
that.setData({
noticeText: app.globalData.noticeText
userInfo: res.data,
isPhone: that.data.userInfo.phone ? true : false
})
if (app.globalData.noticeText) {
that.setData({
noticeText: app.globalData.noticeText
})
}
}
}
},

onShow() {
if (!this.data.checkUserInfo) {
this.getNoticeText()
}
},

getUserProfile() {
// 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认,开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
wx.getUserProfile({
@@ -226,6 +235,31 @@ Page({
})
},

/**
* @description 获取通知栏信息文本
* @returns list
*/
getNoticeText() {
const that = this
request.get({
url: '/api/notice/list'
}).then(res => {
console.log(res, 'getNoticeText');
let noticeText = ''
res.data.forEach((item, index) => {
noticeText += index + 1 + '、' + item.content + ' '
})
app.globalData.noticeText = noticeText
that.setData({
noticeText: noticeText
})
// 检查用户信息
that.checkUserInfo()
}).catch(err => {
console.log(err, 'err');
})
},

onShareAppMessage() {
const promise = new Promise(resolve => {
setTimeout(() => {
@@ -236,7 +270,6 @@ Page({
})
return {
title: '小闲聊',
path: '/pages/index/index',
promise
}
},
@@ -250,7 +283,6 @@ Page({
})
return {
title: '小闲聊',
path: '/pages/index/index',
promise
}
}


+ 2
- 2
miniprogram/utils/request.js Wyświetl plik

@@ -33,9 +33,9 @@ class request {

/**
* @description 小程序appId
* @returns {string} wxf288a9b8167ff2ca
* @returns {string} wxedb9fb309728a9f1
*/
appId = 'wxf288a9b8167ff2ca';
appId = 'wxedb9fb309728a9f1';

/**
* @description get


+ 1
- 1
project.config.json Wyświetl plik

@@ -31,7 +31,7 @@
"simulatorPluginLibVersion": {},
"condition": {},
"srcMiniprogramRoot": "miniprogram/",
"appid": "wxf288a9b8167ff2ca",
"appid": "wxedb9fb309728a9f1",
"libVersion": "2.31.0",
"editorSetting": {
"tabIndent": "insertSpaces",


Ładowanie…
Anuluj
Zapisz