Преглед на файлове

临时保存

release/210823_需求对对碰
王饶冀 преди 3 години
родител
ревизия
74d3c67619

+ 11
- 3
app.js Целия файл

@@ -1,6 +1,12 @@
// app.js
App({
onLaunch() {
// 获取本地用户信息
const userInfo = wx.getStorageSync('userInfo') || null;
if(userInfo){
this.globalData.userInfo = userInfo;
console.log(`从本地拿到的userInfo`)
}
// 版本更新
const updateManager = wx.getUpdateManager()

@@ -53,11 +59,12 @@ App({
js_code: res.code
},
success: (result) => {
console.log("微信LOGIN result")
if (!!result.data && result.data.openid) {
console.log(result, 'result');
// this.globalData.openid = result.data.openid;
this.globalData.appid = result.data.appid;
// this.globalData.sessionKey = result.data.sessionKey;
this.globalData.sessionKey = result.data.sessionKey;
}
}
})
@@ -74,10 +81,11 @@ App({
globalData: {
userInfo: null,
openid: "oBkT7vu1Q8l-xsbux_i1FNmRWuJ4",
// openid:"",
appid: "",
sessionKey: "",
suiteCode: "",
customerId: "666967",
customerId: null,
},
// 跳转登录页
goLogin(e) {

+ 9
- 0
components/listItem/listItem.js Целия файл

@@ -1,4 +1,5 @@
// components/listItem/listItem.js
const app = getApp()
Component({
/**
* 组件的属性列表
@@ -58,5 +59,13 @@ Component({
productCollect(e){
this.triggerEvent('changeCollect');
},
// 聊一聊
goToChat(){
if(!app.globalData.customerId){
app.goLogin();
return
}
console.log(`点击了聊一聊`)
},
}
})

+ 2
- 3
components/listItem/listItem.wxml Целия файл

@@ -23,8 +23,7 @@
<view bindtap="goDetails" data-item="{{ item }}">
<!-- 详情 -->
<view>
<text space class="list-details-text" user-select wx:if="{{ pageStatus == 'detatil' || pageStatus == 'myRelease' }}">
{{ item.info }}
<text space class="list-details-text" user-select wx:if="{{ pageStatus == 'detatil' || pageStatus == 'myRelease' }}">{{ item.info }}
</text>
<text space wx:elif="{{ pageStatus == 'myCollect' }}" class="list-details-text need"><text style="color:red">{{ item.isDeleted > 0 ? '【已删除】' : item.state < 0 ? '【已下架】' : '' }}</text>{{ item.info }}
</text>
@@ -52,7 +51,7 @@
<image class="collect-img" src="/images/home/not-collect.png" wx:else />
收藏
</view>
<view class="fr list-foot-text-chat" wx:if="{{ pageStatus != 'myRelease' }}">
<view class="fr list-foot-text-chat" wx:if="{{ pageStatus != 'myRelease' }}" bindtap="goToChat">
<image class="chat-img" src="/images/home/chat-icon.png" />
聊一聊
</view>

+ 13
- 4
pages/index/components/listDetails/Details.js Целия файл

@@ -10,7 +10,7 @@ Page({
data: {
// 页面Loading
pageLoading: false,
customerId: "666678",
customerId: null,
// 路由接受的参数
currentData: {},
// 感兴趣的需求----
@@ -39,7 +39,14 @@ Page({
type: data.listDetail.type.join(),
pageLoading: true,
})
this.getIsCollect();
if (app.globalData.customerId) {
this.setData({
customerId: app.globalData.customerId
})
this.getIsCollect();
}else{
this.getListData();
}
})
},
// 热门详情点击
@@ -64,7 +71,6 @@ Page({
$request.get('/businessCommunicationCollect/booleanIsCollect.action',
{ customerId, businessCommunicationDemandId: currentData.businessCommunicationDemandId }
).then(res => {
console.log(res);
if (res.status == 0) {
this.setData({
isCollect: res.data == 0 ? false : true
@@ -77,8 +83,11 @@ Page({
},
// 切换收藏
changeCollect() {
// console.log(this.data.currentData)
let { currentData, customerId, isCollect } = this.data;
if(!customerId){
app.goLogin();
return
}
let url = "";
let msg = "";
// 如果已收藏就取消收藏 else 反之

+ 15
- 10
pages/index/components/listDetails/Details.wxml Целия файл

@@ -5,19 +5,24 @@
</view>
<view wx:else>
<view class="list-view">
<listItem item="{{ currentData }}" pageStatus="detatil" isCollect="{{ isCollect }}" bind:changeCollect="changeCollect"/>
<listItem item="{{ currentData }}" pageStatus="detatil" isCollect="{{ isCollect }}" bind:changeCollect="changeCollect" />
</view>
<view class="view-interested">你可能感兴趣的需求</view>
<view class="list-view" wx:for="{{ listData }}" wx:key="*this">
<listItem item="{{ item }}" bind:getItem="goDetails"/>
<view class="not-data" wx:if="{{ listData.length < 1 }}">
<image class="not-data-img" src="/images/home/not-data.png" />
<view class="not-info">没有更多感兴趣的需求</view>
</view>
<view class="text-center" wx:if="{{ itemLoading }}">
<van-loading size="24px">加载中...</van-loading>
</view>
<view class="list-finished text-center" wx:if="{{ isFinished }}">
<image class="finished-img" src="/images/home/finished-icon.png" />
没有更多啦~
<view wx:else>
<view class="list-view" wx:for="{{ listData }}" wx:key="*this">
<listItem item="{{ item }}" bind:getItem="goDetails" />
</view>
<view class="text-center" wx:if="{{ itemLoading }}">
<van-loading size="24px">加载中...</van-loading>
</view>
<view class="list-finished text-center" wx:if="{{ isFinished }}">
<image class="finished-img" src="/images/home/finished-icon.png" />
没有更多啦~
</view>
</view>
</view>
<tabBar currentIndex="{{currentIndex}}"></tabBar>

+ 16
- 5
pages/login/login.js Целия файл

@@ -8,7 +8,7 @@ Page({
*/
data: {

userInfo: {},
userInfo: null,
// 是否获取到了用户信息
hasUserInfo: false,
},
@@ -17,7 +17,12 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {

const userInfo = wx.getStorageSync('userInfo') || null;
if (app.globalData.userInfo || userInfo) {
this.setData({
userInfo
})
}
},

// 获取手机号授权
@@ -60,10 +65,15 @@ Page({
// 获取用户信息弹框
onCheckboxChange() {
if (!this.data.hasUserInfo) {
this.getUserProfile()
if(!this.data.userInfo){
this.getUserProfile()
}else{
this.setData({
hasUserInfo: true
})
}
} else {
this.setData({
userInfo: {},
hasUserInfo: false
})
}
@@ -79,6 +89,7 @@ Page({
userInfo: res.userInfo,
hasUserInfo: true
})
wx.setStorageSync('userInfo', res.userInfo)
},
fail: () => {
wx.showToast({
@@ -97,7 +108,7 @@ Page({
mask: true
})
$request.post('/script/getSession.action', {}).then(res => {
console.log(res,'getUserSession---res')
console.log(res, 'getUserSession---res')
wx.hideLoading()
app.globalData.customerId = res.data.customer.customerId
// wx.navigateTo({

+ 1
- 1
project.config.json Целия файл

@@ -45,7 +45,7 @@
},
"compileType": "miniprogram",
"libVersion": "2.18.1",
"appid": "wx2fb79bf1a0f4a450",
"appid": "wx4fdcd0cabdcd387b",
"projectname": "channel_business",
"debugOptions": {
"hidedInDevtools": []

Loading…
Отказ
Запис