Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
施宇
/
icsalesProgram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
63c8e5ba
authored
Aug 16, 2019
by
施宇
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
1111
parent
188b38a1
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
105 additions
and
86 deletions
components/priceItem/priceItem.js
pages/detail/good/index.js
pages/list/qd/index.js
pages/search/result/index.js
pages/search/result/index.wxml
pages/search/result/index.wxss
pages/tab/good/good.json
pages/tab/price/price.js
project.config.json
utils/api.js
utils/util.js
components/priceItem/priceItem.js
View file @
63c8e5ba
// components/priceItem/priceItem.js
import
{
judgeToken
}
from
'../../utils/util.js'
;
Component
({
/**
* 组件的属性列表
...
...
@@ -30,14 +33,13 @@ Component({
*/
methods
:
{
emitevent
:
function
(
e
)
{
let
token
=
wx
.
getStorageSync
(
'access_token'
);
let
inquiryItemsId
=
e
.
currentTarget
.
dataset
.
inquiryitemsid
;
let
goodId
=
e
.
currentTarget
.
dataset
.
goodid
;
let
offerId
=
e
.
currentTarget
.
dataset
.
offerid
;
let
xb
=
e
.
currentTarget
.
dataset
.
xb
;
let
type
=
e
.
currentTarget
.
dataset
.
type
;
//1代表询价 2代表报价 3代表商品
let
priceType
=
e
.
currentTarget
.
dataset
.
pricetype
;
if
(
token
)
{
if
(
judgeToken
(
true
)
)
{
if
(
priceType
==
1
)
{
if
(
type
==
1
)
{
wx
.
navigateTo
({
...
...
@@ -70,12 +72,6 @@ Component({
url
:
"/pages/detail/good/index?goodId="
+
goodId
+
'&type=1'
})
}
}
else
{
wx
.
showToast
({
title
:
'请先登入'
,
icon
:
'none'
,
duration
:
2000
});
}
},
previewImage
:
function
(
e
)
{
...
...
pages/detail/good/index.js
View file @
63c8e5ba
// pages/detail/good/index.js
import
{
getData
,
changeTime
}
from
'../../../utils/util.js'
;
import
{
getData
,
changeTime
}
from
'../../../utils/util.js'
;
import
{
apis
}
from
'../../../utils/api.js'
;
Page
({
...
...
@@ -8,9 +8,9 @@ Page({
*/
data
:
{
info
:
null
,
editOrShow
:
-
1
,
//1编辑 2在线沟通
goodId
:
""
,
type
:
""
,
editOrShow
:
-
1
,
//1编辑 2在线沟通
goodId
:
""
,
type
:
""
,
},
/**
...
...
@@ -21,7 +21,7 @@ Page({
goodId
:
options
.
goodId
||
''
,
type
:
options
.
type
||
''
})
},
getData
:
function
()
{
let
me
=
this
;
...
...
@@ -31,11 +31,11 @@ Page({
let
type
=
me
.
data
.
type
;
if
(
type
==
1
)
{
url
=
apis
.
goodsInfo
;
}
else
if
(
type
==
2
)
{
}
else
if
(
type
==
2
||
type
==
3
)
{
url
=
apis
.
goodsSearch
;
}
else
{
return
;
}
getData
(
url
,
'get'
,
{
"goods_id/eq"
:
goodId
,
...
...
@@ -49,11 +49,11 @@ Page({
}
else
{
let
userId
=
wx
.
getStorageSync
(
'user_id'
);
let
targetId
=
res
.
goods_list
[
goodId
][
'user_id'
];
if
(
type
==
1
)
{
if
(
type
==
1
)
{
me
.
setData
({
editOrShow
:
1
})
}
else
if
(
type
==
2
)
{
}
else
if
(
type
==
2
)
{
if
(
userId
==
targetId
)
{
me
.
setData
({
editOrShow
:
1
...
...
@@ -77,12 +77,12 @@ Page({
}
},
true
)
},
editGood
:
function
()
{
editGood
:
function
()
{
wx
.
navigateTo
({
url
:
"/pages/form/good/index?goodId="
+
this
.
data
.
goodId
,
url
:
"/pages/form/good/index?goodId="
+
this
.
data
.
goodId
,
})
},
sendTemplate
:
function
()
{
sendTemplate
:
function
()
{
let
data
=
this
.
data
.
info
;
let
my
=
wx
.
getStorageSync
(
"myUsername"
);
let
companyName
=
wx
.
getStorageSync
(
"company_name"
);
...
...
pages/list/qd/index.js
View file @
63c8e5ba
...
...
@@ -49,7 +49,7 @@ Page({
total
:
res
.
total
,
});
}
else
{
if
(
(
me
.
data
.
p
==
1
)
&&
(
res
.
errcode
==
(
105001
||
105015
))
)
{
if
(
me
.
data
.
p
==
1
)
{
me
.
setData
({
priceList
:
[]
})
...
...
pages/search/result/index.js
View file @
63c8e5ba
...
...
@@ -16,6 +16,7 @@ Page({
key
:
""
,
confirmKey
:
""
,
isShowBottom
:
false
,
token
:
''
},
...
...
@@ -27,7 +28,8 @@ Page({
let
key
=
options
.
key
;
this
.
setData
({
key
:
key
,
confirmKey
:
key
confirmKey
:
key
,
token
:
wx
.
getStorageSync
(
'access_token'
)
||
''
});
this
.
storageKey
(
key
)
this
.
getData
();
...
...
pages/search/result/index.wxml
View file @
63c8e5ba
<!--pages/searchresult/index.wxml-->
<view class="searchresult-view">
<view class="searchresult-view
{{token?'searchresult-padding-bottom':''}}
">
<view class="search-com">
<text class="icon iconfont iconiconxiantiaoshouji8"></text>
<input placeholder='请输入芯片型号' placeholder-class="placeholderClass" value="{{key}}" bindinput="bindKeyInput" bindconfirm="bindKeyConfirm"></input>
...
...
@@ -19,13 +19,13 @@
<image src="/res/images/imgs/nodata.png" class="img"></image>
<view class="h3 bold">未搜索到相关信息</view>
<view class="p">
<text wx:if="{{tabIndex == 2}}">您还可以发布询价。</text>
<text wx:if="{{tabIndex == 1}}">您还可以新增商品。</text>
<text wx:if="{{tabIndex == 2
&&token
}}">您还可以发布询价。</text>
<text wx:if="{{tabIndex == 1
&&token
}}">您还可以新增商品。</text>
</view>
<view class="nodata_fb btn-com btn-com-b" bindtap="toXj" wx:if="{{tabIndex == 2}}">
<view class="nodata_fb btn-com btn-com-b" bindtap="toXj" wx:if="{{tabIndex == 2
&&token
}}">
<text>快速发布询价</text>
</view>
<view class="nodata_fb btn-com btn-com-b" bindtap="toSp" wx:if="{{tabIndex == 1}}">
<view class="nodata_fb btn-com btn-com-b" bindtap="toSp" wx:if="{{tabIndex == 1
&&token
}}">
<text class="icon iconfont iconiconxiantiaoshouji15"></text>
<text>新增商品</text>
</view>
...
...
@@ -37,18 +37,18 @@
<text class="line"></text>
</view>
</view>
<view class="fast_fb_view" wx:if="{{priceList&&priceList.length!==0&&tabIndex == 2}}">
<view class="fast_fb_view" wx:if="{{priceList&&priceList.length!==0&&tabIndex == 2
&&token
}}">
<view class="fast_fb btn-com btn-com-b" bindtap="toXj">
<text>快速发布询价</text>
</view>
</view>
<view class="fast_fb_view" wx:if="{{priceList&&priceList.length!==0&&tabIndex == 1}}">
<view class="fast_fb_view" wx:if="{{priceList&&priceList.length!==0&&tabIndex == 1
&&token
}}">
<view class="fast_fb btn-com btn-com-b" bindtap="toSp">
<text class="icon iconfont iconiconxiantiaoshouji15"></text>
<text>新增商品</text>
</view>
</view>
<view class="concat_custom" wx:if="{{priceList&&priceList.length==0&&tabIndex == 2}}">
<view class="concat_custom" wx:if="{{priceList&&priceList.length==0&&tabIndex == 2
&&token
}}">
<text class="icon iconfont iconiconxiantiaoshouji11" bindtap="sendCustomer"></text>
<text bindtap="sendCustomer">联系客服帮您找</text>
</view>
...
...
pages/search/result/index.wxss
View file @
63c8e5ba
...
...
@@ -4,9 +4,11 @@
min-height: 100%;
position: relative;
box-sizing: border-box;
padding:174rpx 0 158rpx;
padding-top:174rpx;
}
.searchresult-padding-bottom{
padding-bottom:158rpx;
}
.searchresult-view .search-com, .searchresult-view .switch-tab-com {
position: fixed;
top: 0;
...
...
pages/tab/good/good.json
View file @
63c8e5ba
...
...
@@ -2,6 +2,5 @@
"usingComponents"
:
{
"priceItem"
:
"/components/priceItem/priceItem"
},
"navigationBarTitleText"
:
"商品管理"
,
"enablePullDownRefresh"
:
true
"navigationBarTitleText"
:
"商品管理"
}
\ No newline at end of file
pages/tab/price/price.js
View file @
63c8e5ba
...
...
@@ -50,7 +50,7 @@ Page({
total
:
res
.
total
,
});
}
else
{
if
(
(
me
.
data
.
p
==
1
)
&&
(
res
.
errcode
==
(
105001
||
105015
))
){
if
(
me
.
data
.
p
==
1
){
me
.
setData
({
priceList
:
[]
})
...
...
project.config.json
View file @
63c8e5ba
...
...
@@ -48,7 +48,7 @@
"list"
:
[]
},
"miniprogram"
:
{
"current"
:
2
5
,
"current"
:
2
6
,
"list"
:
[
{
"id"
:
-1
,
...
...
@@ -229,6 +229,14 @@
"id"
:
-1
,
"name"
:
"pages/tab/home/home"
,
"pathName"
:
"pages/tab/home/home"
,
"query"
:
""
,
"scene"
:
null
},
{
"id"
:
26
,
"name"
:
"pages/detail/good/index"
,
"pathName"
:
"pages/detail/good/index"
,
"query"
:
"goodId=156274103196309&type=3"
,
"scene"
:
null
}
]
...
...
utils/api.js
View file @
63c8e5ba
const
auth_url
=
'http://authapi.icsales.cc'
;
const
so_url
=
'http://soapi.icsales.cc'
;
const
offer_url
=
"http://offerapi.icsales.cc"
;
const
user_url
=
'http://userapi.icsales.cc'
;
const
goods_url
=
'http://goodsapi.icsales.cc'
;
const
home_url
=
'http://home.icsales.cc'
;
const
auth_url
=
'https://authapi.icsales.com'
;
const
so_url
=
'https://soapi.icsales.com'
;
const
offer_url
=
"https://offerapi.icsales.com"
;
const
user_url
=
'https://userapi.icsales.com'
;
const
goods_url
=
'https://goodsapi.icsales.com'
;
const
home_url
=
'https://home.icsales.com'
;
// const auth_url = 'http://authapi.icsales.cc';
// const so_url = 'http://soapi.icsales.cc';
// const offer_url = "http://offerapi.icsales.cc";
// const user_url = 'http://userapi.icsales.cc';
// const goods_url = 'http://goodsapi.icsales.cc';
// const home_url = 'http://home.icsales.cc';
const
apis
=
{
/**
...
...
utils/util.js
View file @
63c8e5ba
...
...
@@ -86,48 +86,46 @@ const getData = (url, type, param, callBack, loading, isheader, istoken) => {
};
//上传文件
const
uploadFile
=
(
url
,
path
s
,
callBack
)
=>
{
const
uploadFile
=
(
url
,
path
,
callBack
)
=>
{
wx
.
showLoading
({
title
:
'上传中'
,
mask
:
true
})
for
(
var
i
=
0
;
i
<
paths
.
length
;
i
++
)
{
wx
.
uploadFile
({
url
:
url
,
filePath
:
paths
[
i
],
name
:
'upload'
,
formData
:
{
token
:
wx
.
getStorageSync
(
'access_token'
),
source
:
2
},
header
:
{
"Content-Type"
:
"multipart/form-data"
},
success
:
(
res
)
=>
{
var
data
=
JSON
.
parse
(
res
.
data
);
if
(
data
.
errcode
==
103200
)
{
callBack
(
data
.
data
[
0
])
}
else
{
wx
.
showToast
({
title
:
'上传失败'
,
icon
:
'none'
,
duration
:
2000
});
}
},
fail
:
(
e
)
=>
{
console
.
log
(
e
)
});
wx
.
uploadFile
({
url
:
url
,
filePath
:
path
,
name
:
'upload'
,
formData
:
{
token
:
wx
.
getStorageSync
(
'access_token'
),
source
:
2
},
success
:
(
res
)
=>
{
console
.
log
(
res
)
var
data
=
JSON
.
parse
(
res
.
data
);
console
.
log
(
data
)
if
(
data
.
errcode
==
103200
)
{
callBack
(
data
.
data
[
0
])
}
else
{
wx
.
showToast
({
title
:
'上传失败'
,
icon
:
'none'
,
duration
:
2000
});
},
complete
:
()
=>
{
wx
.
hideLoading
();
}
})
}
},
fail
:
(
e
)
=>
{
console
.
log
(
e
)
wx
.
showToast
({
title
:
'上传失败'
,
icon
:
'none'
,
duration
:
2000
});
},
complete
:
()
=>
{
wx
.
hideLoading
();
}
})
};
const
chooseImg
=
(
url
,
num
,
callback
)
=>
{
...
...
@@ -136,7 +134,7 @@ const chooseImg = (url, num, callback) => {
sizeType
:
[
'original'
,
'compressed'
],
sourceType
:
[
'album'
,
'camera'
],
success
:
(
res
)
=>
{
uploadFile
(
url
,
res
.
tempFilePaths
,
(
rtn
)
=>
{
uploadFile
(
url
,
res
.
tempFilePaths
[
0
]
,
(
rtn
)
=>
{
callback
(
rtn
)
})
}
...
...
@@ -217,20 +215,20 @@ const sha1 = (s) => {
s
[
l
-
1
]
=
data
.
length
<<
3
;
var
w
=
[],
f
=
[
function
()
{
function
()
{
return
m
[
1
]
&
m
[
2
]
|
~
m
[
1
]
&
m
[
3
];
},
function
()
{
function
()
{
return
m
[
1
]
^
m
[
2
]
^
m
[
3
];
},
function
()
{
function
()
{
return
m
[
1
]
&
m
[
2
]
|
m
[
1
]
&
m
[
3
]
|
m
[
2
]
&
m
[
3
];
},
function
()
{
function
()
{
return
m
[
1
]
^
m
[
2
]
^
m
[
3
];
}
],
rol
=
function
(
n
,
c
)
{
rol
=
function
(
n
,
c
)
{
return
n
<<
c
|
n
>>>
(
32
-
c
);
},
k
=
[
1518500249
,
1859775393
,
-
1894007588
,
-
899497514
],
...
...
@@ -247,7 +245,7 @@ const sha1 = (s) => {
t
=
new
DataView
(
new
Uint32Array
(
m
).
buffer
);
for
(
var
i
=
0
;
i
<
5
;
i
++
)
m
[
i
]
=
t
.
getUint32
(
i
<<
2
);
var
hex
=
Array
.
prototype
.
map
.
call
(
new
Uint8Array
(
new
Uint32Array
(
m
).
buffer
),
function
(
e
)
{
var
hex
=
Array
.
prototype
.
map
.
call
(
new
Uint8Array
(
new
Uint32Array
(
m
).
buffer
),
function
(
e
)
{
return
(
e
<
16
?
"0"
:
""
)
+
e
.
toString
(
16
);
}).
join
(
""
);
return
hex
;
...
...
@@ -273,9 +271,16 @@ const judgeToken = (boolen) => {
return
true
}
else
{
if
(
boolen
)
{
wx
.
redirectTo
({
url
:
'/pages/person/login/index'
})
if
(
wx
.
getStorageSync
(
'auth'
))
{
wx
.
redirectTo
({
url
:
'/pages/person/login/index'
})
}
else
{
wx
.
redirectTo
({
url
:
'/pages/person/auth/index'
})
}
}
return
false
;
}
...
...
@@ -306,7 +311,7 @@ const interval = (usedTime) => {
}
}
}
const
matchReg
=
(
str
)
=>
{
const
matchReg
=
(
str
)
=>
{
let
reg
=
/<
\/?
.+
?\/?
>/g
;
let
newStr
=
str
.
replace
(
reg
,
''
);
return
newStr
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment