|
|
@@ -9,7 +9,7 @@
|
|
|
>
|
|
|
<view class="picker_title">
|
|
|
<view class="pickername">
|
|
|
- <view v-if="array[index].name != undefind">
|
|
|
+ <view v-if="index != -1">
|
|
|
{{ array[index].name }}
|
|
|
</view>
|
|
|
<view v-else>类型</view>
|
|
|
@@ -23,7 +23,7 @@
|
|
|
class="supplyCard"
|
|
|
v-for="(supply, i) in supplyList"
|
|
|
:key="i"
|
|
|
- @tap="toDetail(i)"
|
|
|
+ @tap="toDetail(supply.id)"
|
|
|
>
|
|
|
<view class="image_content">
|
|
|
<image :src="supply.image" />
|
|
|
@@ -58,27 +58,93 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import md5 from "@/common/md5.js";
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- supplyList: new Array(5).fill({
|
|
|
- image: "/static/supply/u1779.png",
|
|
|
- title: "移动式空气消毒机",
|
|
|
- time: "2021-08-30 14:50:00",
|
|
|
- }),
|
|
|
+ supplyList: [],
|
|
|
array: [{ name: "全部" }, { name: "供需" }, { name: "需求" }],
|
|
|
- index: undefined,
|
|
|
+ index: -1,
|
|
|
};
|
|
|
},
|
|
|
+ onLoad() {
|
|
|
+ this.getMyList();
|
|
|
+ },
|
|
|
methods: {
|
|
|
bindPickerChange(e) {
|
|
|
this.index = e.detail.value;
|
|
|
+ this.getMyList();
|
|
|
},
|
|
|
toDetail(index) {
|
|
|
uni.navigateTo({
|
|
|
url: "/pages/supply/supply_detail?id=" + index,
|
|
|
});
|
|
|
},
|
|
|
+ getMyList() {
|
|
|
+ let md5Sign = md5(
|
|
|
+ "method=" +
|
|
|
+ "need" +
|
|
|
+ "×tamp=" +
|
|
|
+ getApp().globalData.globalTimestamp +
|
|
|
+ "&secret=" +
|
|
|
+ getApp().globalData.secret
|
|
|
+ );
|
|
|
+ let url =
|
|
|
+ getApp().globalData.shareUrl +
|
|
|
+ "api/api.php" +
|
|
|
+ "?method=need&source=need&action=list×tamp=" +
|
|
|
+ getApp().globalData.globalTimestamp +
|
|
|
+ "&sign=" +
|
|
|
+ md5Sign;
|
|
|
+ let postData = {
|
|
|
+ s_type:this.index==2?1:2
|
|
|
+ }
|
|
|
+ uni.request({
|
|
|
+ url: url,
|
|
|
+ method: "POST",
|
|
|
+ header: {
|
|
|
+ "content-type": "application/x-www-form-urlencoded",
|
|
|
+ },
|
|
|
+ data: this.index==-1||this.index==0?{}:postData,
|
|
|
+ success: (res) => {
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ let list = res.data.data.list;
|
|
|
+ /*
|
|
|
+ supplyList: new Array(5).fill({
|
|
|
+ image: "/static/supply/u1779.png",
|
|
|
+ title: "移动式空气消毒机",
|
|
|
+ time: "2021-08-30 14:50:00",
|
|
|
+ state: 1,
|
|
|
+ }),
|
|
|
+
|
|
|
+ */
|
|
|
+ this.supplyList = list.map((item) => {
|
|
|
+ let ob = {
|
|
|
+ image: "",
|
|
|
+ title: "",
|
|
|
+ time: "",
|
|
|
+ state: "",
|
|
|
+ id: "",
|
|
|
+ };
|
|
|
+ ob.id = item.id;
|
|
|
+ ob.title = item.title;
|
|
|
+ let time = this.$options.filters["globalTime"](item.addtime);
|
|
|
+ let timeSecond = this.$options.filters["globalTimeSecond"](
|
|
|
+ item.addtime
|
|
|
+ );
|
|
|
+ ob.time = time + " " + timeSecond;
|
|
|
+ ob.state = item.type;
|
|
|
+ ob.image = item.url;
|
|
|
+ return ob;
|
|
|
+ });
|
|
|
+ console.log(res.data.data.list);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
+ console.log("连接失败");
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
@@ -142,12 +208,12 @@ export default {
|
|
|
z-index: 999;
|
|
|
display: flex;
|
|
|
justify-content: space-around;
|
|
|
- width:80%;
|
|
|
+ width: 80%;
|
|
|
// height: 6%;
|
|
|
position: fixed;
|
|
|
top: 85%;
|
|
|
left: 50%;
|
|
|
- padding:4%;
|
|
|
+ padding: 4%;
|
|
|
border-radius: 40rpx;
|
|
|
box-shadow: rgba(100, 100, 111, 0.2) 0rpx 14rpx 50rpx 0rpx;
|
|
|
transform: translateX(-50%);
|