Commit 63c8e5ba by 施宇

1111

parent 188b38a1
// components/priceItem/priceItem.js // components/priceItem/priceItem.js
import {
judgeToken
} from '../../utils/util.js';
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
...@@ -30,14 +33,13 @@ Component({ ...@@ -30,14 +33,13 @@ Component({
*/ */
methods: { methods: {
emitevent: function (e) { emitevent: function (e) {
let token = wx.getStorageSync('access_token');
let inquiryItemsId = e.currentTarget.dataset.inquiryitemsid; let inquiryItemsId = e.currentTarget.dataset.inquiryitemsid;
let goodId = e.currentTarget.dataset.goodid; let goodId = e.currentTarget.dataset.goodid;
let offerId = e.currentTarget.dataset.offerid; let offerId = e.currentTarget.dataset.offerid;
let xb = e.currentTarget.dataset.xb; let xb = e.currentTarget.dataset.xb;
let type = e.currentTarget.dataset.type;//1代表询价 2代表报价 3代表商品 let type = e.currentTarget.dataset.type;//1代表询价 2代表报价 3代表商品
let priceType = e.currentTarget.dataset.pricetype; let priceType = e.currentTarget.dataset.pricetype;
if (token) { if (judgeToken(true)) {
if (priceType == 1) { if (priceType == 1) {
if (type == 1) { if (type == 1) {
wx.navigateTo({ wx.navigateTo({
...@@ -70,12 +72,6 @@ Component({ ...@@ -70,12 +72,6 @@ Component({
url: "/pages/detail/good/index?goodId=" + goodId + '&type=1' url: "/pages/detail/good/index?goodId=" + goodId + '&type=1'
}) })
} }
} else {
wx.showToast({
title: '请先登入',
icon: 'none',
duration: 2000
});
} }
}, },
previewImage: function (e) { previewImage: function (e) {
......
// pages/detail/good/index.js // 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'; import { apis } from '../../../utils/api.js';
Page({ Page({
...@@ -8,9 +8,9 @@ Page({ ...@@ -8,9 +8,9 @@ Page({
*/ */
data: { data: {
info: null, info: null,
editOrShow:-1,//1编辑 2在线沟通 editOrShow: -1,//1编辑 2在线沟通
goodId:"", goodId: "",
type:"", type: "",
}, },
/** /**
...@@ -21,7 +21,7 @@ Page({ ...@@ -21,7 +21,7 @@ Page({
goodId: options.goodId || '', goodId: options.goodId || '',
type: options.type || '' type: options.type || ''
}) })
}, },
getData: function () { getData: function () {
let me = this; let me = this;
...@@ -31,11 +31,11 @@ Page({ ...@@ -31,11 +31,11 @@ Page({
let type = me.data.type; let type = me.data.type;
if (type == 1) { if (type == 1) {
url = apis.goodsInfo; url = apis.goodsInfo;
} else if (type == 2) { } else if (type == 2 || type == 3) {
url = apis.goodsSearch; url = apis.goodsSearch;
} else { } else {
return; return;
} }
getData(url, 'get', { getData(url, 'get', {
"goods_id/eq": goodId, "goods_id/eq": goodId,
...@@ -49,11 +49,11 @@ Page({ ...@@ -49,11 +49,11 @@ Page({
} else { } else {
let userId = wx.getStorageSync('user_id'); let userId = wx.getStorageSync('user_id');
let targetId = res.goods_list[goodId]['user_id']; let targetId = res.goods_list[goodId]['user_id'];
if(type == 1){ if (type == 1) {
me.setData({ me.setData({
editOrShow: 1 editOrShow: 1
}) })
}else if(type == 2){ } else if (type == 2) {
if (userId == targetId) { if (userId == targetId) {
me.setData({ me.setData({
editOrShow: 1 editOrShow: 1
...@@ -77,12 +77,12 @@ Page({ ...@@ -77,12 +77,12 @@ Page({
} }
}, true) }, true)
}, },
editGood:function(){ editGood: function () {
wx.navigateTo({ 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 data = this.data.info;
let my = wx.getStorageSync("myUsername"); let my = wx.getStorageSync("myUsername");
let companyName = wx.getStorageSync("company_name"); let companyName = wx.getStorageSync("company_name");
......
...@@ -49,7 +49,7 @@ Page({ ...@@ -49,7 +49,7 @@ Page({
total: res.total, total: res.total,
}); });
} else { } else {
if ((me.data.p == 1) && (res.errcode == (105001 || 105015))) { if (me.data.p == 1) {
me.setData({ me.setData({
priceList: [] priceList: []
}) })
......
...@@ -16,6 +16,7 @@ Page({ ...@@ -16,6 +16,7 @@ Page({
key: "", key: "",
confirmKey: "", confirmKey: "",
isShowBottom: false, isShowBottom: false,
token:''
}, },
...@@ -27,7 +28,8 @@ Page({ ...@@ -27,7 +28,8 @@ Page({
let key = options.key; let key = options.key;
this.setData({ this.setData({
key: key, key: key,
confirmKey: key confirmKey: key,
token: wx.getStorageSync('access_token') || ''
}); });
this.storageKey(key) this.storageKey(key)
this.getData(); this.getData();
......
<!--pages/searchresult/index.wxml--> <!--pages/searchresult/index.wxml-->
<view class="searchresult-view"> <view class="searchresult-view {{token?'searchresult-padding-bottom':''}}">
<view class="search-com"> <view class="search-com">
<text class="icon iconfont iconiconxiantiaoshouji8"></text> <text class="icon iconfont iconiconxiantiaoshouji8"></text>
<input placeholder='请输入芯片型号' placeholder-class="placeholderClass" value="{{key}}" bindinput="bindKeyInput" bindconfirm="bindKeyConfirm"></input> <input placeholder='请输入芯片型号' placeholder-class="placeholderClass" value="{{key}}" bindinput="bindKeyInput" bindconfirm="bindKeyConfirm"></input>
...@@ -19,13 +19,13 @@ ...@@ -19,13 +19,13 @@
<image src="/res/images/imgs/nodata.png" class="img"></image> <image src="/res/images/imgs/nodata.png" class="img"></image>
<view class="h3 bold">未搜索到相关信息</view> <view class="h3 bold">未搜索到相关信息</view>
<view class="p"> <view class="p">
<text wx:if="{{tabIndex == 2}}">您还可以发布询价。</text> <text wx:if="{{tabIndex == 2&&token}}">您还可以发布询价。</text>
<text wx:if="{{tabIndex == 1}}">您还可以新增商品。</text> <text wx:if="{{tabIndex == 1&&token}}">您还可以新增商品。</text>
</view> </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> <text>快速发布询价</text>
</view> </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 class="icon iconfont iconiconxiantiaoshouji15"></text>
<text>新增商品</text> <text>新增商品</text>
</view> </view>
...@@ -37,18 +37,18 @@ ...@@ -37,18 +37,18 @@
<text class="line"></text> <text class="line"></text>
</view> </view>
</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"> <view class="fast_fb btn-com btn-com-b" bindtap="toXj">
<text>快速发布询价</text> <text>快速发布询价</text>
</view> </view>
</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"> <view class="fast_fb btn-com btn-com-b" bindtap="toSp">
<text class="icon iconfont iconiconxiantiaoshouji15"></text> <text class="icon iconfont iconiconxiantiaoshouji15"></text>
<text>新增商品</text> <text>新增商品</text>
</view> </view>
</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 class="icon iconfont iconiconxiantiaoshouji11" bindtap="sendCustomer"></text>
<text bindtap="sendCustomer">联系客服帮您找</text> <text bindtap="sendCustomer">联系客服帮您找</text>
</view> </view>
......
...@@ -4,9 +4,11 @@ ...@@ -4,9 +4,11 @@
min-height: 100%; min-height: 100%;
position: relative; position: relative;
box-sizing: border-box; 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 { .searchresult-view .search-com, .searchresult-view .switch-tab-com {
position: fixed; position: fixed;
top: 0; top: 0;
......
...@@ -2,6 +2,5 @@ ...@@ -2,6 +2,5 @@
"usingComponents": { "usingComponents": {
"priceItem": "/components/priceItem/priceItem" "priceItem": "/components/priceItem/priceItem"
}, },
"navigationBarTitleText": "商品管理", "navigationBarTitleText": "商品管理"
"enablePullDownRefresh":true
} }
\ No newline at end of file
...@@ -50,7 +50,7 @@ Page({ ...@@ -50,7 +50,7 @@ Page({
total:res.total, total:res.total,
}); });
}else{ }else{
if ((me.data.p == 1) && (res.errcode == (105001 || 105015))){ if (me.data.p == 1){
me.setData({ me.setData({
priceList: [] priceList: []
}) })
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
"list": [] "list": []
}, },
"miniprogram": { "miniprogram": {
"current": 25, "current": 26,
"list": [ "list": [
{ {
"id": -1, "id": -1,
...@@ -229,6 +229,14 @@ ...@@ -229,6 +229,14 @@
"id": -1, "id": -1,
"name": "pages/tab/home/home", "name": "pages/tab/home/home",
"pathName": "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 "scene": null
} }
] ]
......
const auth_url = 'http://authapi.icsales.cc'; const auth_url = 'https://authapi.icsales.com';
const so_url = 'http://soapi.icsales.cc'; const so_url = 'https://soapi.icsales.com';
const offer_url = "http://offerapi.icsales.cc"; const offer_url = "https://offerapi.icsales.com";
const user_url = 'http://userapi.icsales.cc'; const user_url = 'https://userapi.icsales.com';
const goods_url = 'http://goodsapi.icsales.cc'; const goods_url = 'https://goodsapi.icsales.com';
const home_url = 'http://home.icsales.cc'; 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 = { const apis = {
/** /**
......
...@@ -86,48 +86,46 @@ const getData = (url, type, param, callBack, loading, isheader, istoken) => { ...@@ -86,48 +86,46 @@ const getData = (url, type, param, callBack, loading, isheader, istoken) => {
}; };
//上传文件 //上传文件
const uploadFile = (url, paths, callBack) => { const uploadFile = (url, path, callBack) => {
wx.showLoading({ wx.showLoading({
title: '上传中', title: '上传中',
mask: true mask: true
}) });
for (var i = 0; i < paths.length; i++) { wx.uploadFile({
wx.uploadFile({ url: url,
url: url, filePath: path,
filePath: paths[i], name: 'upload',
name: 'upload', formData: {
formData: { token: wx.getStorageSync('access_token'),
token: wx.getStorageSync('access_token'), source: 2
source: 2 },
}, success: (res) => {
header: { console.log(res)
"Content-Type": "multipart/form-data" var data = JSON.parse(res.data);
}, console.log(data)
success: (res) => { if (data.errcode == 103200) {
var data = JSON.parse(res.data); callBack(data.data[0])
if (data.errcode == 103200) { } else {
callBack(data.data[0])
} else {
wx.showToast({
title: '上传失败',
icon: 'none',
duration: 2000
});
}
},
fail: (e) => {
console.log(e)
wx.showToast({ wx.showToast({
title: '上传失败', title: '上传失败',
icon: 'none', icon: 'none',
duration: 2000 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) => { const chooseImg = (url, num, callback) => {
...@@ -136,7 +134,7 @@ const chooseImg = (url, num, callback) => { ...@@ -136,7 +134,7 @@ const chooseImg = (url, num, callback) => {
sizeType: ['original', 'compressed'], sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'], sourceType: ['album', 'camera'],
success: (res) => { success: (res) => {
uploadFile(url, res.tempFilePaths, (rtn) => { uploadFile(url, res.tempFilePaths[0], (rtn) => {
callback(rtn) callback(rtn)
}) })
} }
...@@ -217,20 +215,20 @@ const sha1 = (s) => { ...@@ -217,20 +215,20 @@ const sha1 = (s) => {
s[l - 1] = data.length << 3; s[l - 1] = data.length << 3;
var w = [], var w = [],
f = [ f = [
function () { function() {
return m[1] & m[2] | ~m[1] & m[3]; return m[1] & m[2] | ~m[1] & m[3];
}, },
function () { function() {
return m[1] ^ m[2] ^ m[3]; return m[1] ^ m[2] ^ m[3];
}, },
function () { function() {
return m[1] & m[2] | m[1] & m[3] | m[2] & m[3]; return m[1] & m[2] | m[1] & m[3] | m[2] & m[3];
}, },
function () { function() {
return m[1] ^ m[2] ^ m[3]; return m[1] ^ m[2] ^ m[3];
} }
], ],
rol = function (n, c) { rol = function(n, c) {
return n << c | n >>> (32 - c); return n << c | n >>> (32 - c);
}, },
k = [1518500249, 1859775393, -1894007588, -899497514], k = [1518500249, 1859775393, -1894007588, -899497514],
...@@ -247,7 +245,7 @@ const sha1 = (s) => { ...@@ -247,7 +245,7 @@ const sha1 = (s) => {
t = new DataView(new Uint32Array(m).buffer); t = new DataView(new Uint32Array(m).buffer);
for (var i = 0; i < 5; i++) m[i] = t.getUint32(i << 2); 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); return (e < 16 ? "0" : "") + e.toString(16);
}).join(""); }).join("");
return hex; return hex;
...@@ -273,9 +271,16 @@ const judgeToken = (boolen) => { ...@@ -273,9 +271,16 @@ const judgeToken = (boolen) => {
return true return true
} else { } else {
if (boolen) { if (boolen) {
wx.redirectTo({ if (wx.getStorageSync('auth')) {
url: '/pages/person/login/index' wx.redirectTo({
}) url: '/pages/person/login/index'
})
} else {
wx.redirectTo({
url: '/pages/person/auth/index'
})
}
} }
return false; return false;
} }
...@@ -306,7 +311,7 @@ const interval = (usedTime) => { ...@@ -306,7 +311,7 @@ const interval = (usedTime) => {
} }
} }
} }
const matchReg = (str)=>{ const matchReg = (str) => {
let reg = /<\/?.+?\/?>/g; let reg = /<\/?.+?\/?>/g;
let newStr = str.replace(reg, ''); let newStr = str.replace(reg, '');
return newStr return newStr
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment