Compare commits
233 Commits
feature/请求
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b78df1d5f6 | ||
|
|
6e5d15da08 | ||
|
|
3be865e508 | ||
|
|
a6310d5db0 | ||
|
|
f8c435839a | ||
|
|
c6e63a91a0 | ||
|
|
ea0e1f05cf | ||
|
|
bfb3ef2f2b | ||
|
|
cde4f8d2c7 | ||
|
|
85eda860b3 | ||
|
|
0ec34f6b2f | ||
|
|
210afd8c84 | ||
|
|
5d4ffc01c7 | ||
|
|
7b84933f91 | ||
|
|
e81b87f827 | ||
|
|
2ed2e2201f | ||
|
|
5f3889217b | ||
|
|
4b15b475af | ||
|
|
05c44c81a9 | ||
|
|
88adaf8af7 | ||
|
|
0b8b80a74b | ||
|
|
139ac36ddf | ||
|
|
b18b17c132 | ||
|
|
8b9d3f98b2 | ||
|
|
6955f5f451 | ||
|
|
1ba6284b78 | ||
|
|
ed2da4e9b4 | ||
|
|
3095df7065 | ||
|
|
050739652d | ||
|
|
9c6357a5f8 | ||
|
|
960e8848f9 | ||
|
|
96da9701d4 | ||
|
|
077801fd6f | ||
|
|
17d399ebd9 | ||
|
|
08d66a18d2 | ||
|
|
e6ac333189 | ||
|
|
6a1e71ce8a | ||
|
|
8da8319619 | ||
|
|
055381f224 | ||
|
|
31efd6466e | ||
|
|
fd3b8347a4 | ||
|
|
f3eb6b98d6 | ||
|
|
b0d3372b7c | ||
|
|
c4ecf247de | ||
|
|
b439c3dd7a | ||
|
|
72a9fa92e3 | ||
|
|
8bdb156ec2 | ||
|
|
afccd4c183 | ||
|
|
e5c257ed2d | ||
|
|
3f3226c302 | ||
|
|
deb66d77fd | ||
|
|
e1551144a9 | ||
|
|
d08d126f2f | ||
|
|
0e6d4f02a2 | ||
|
|
f6544ea71a | ||
|
|
8db95277dd | ||
|
|
e43af048c1 | ||
|
|
6dfd04bb87 | ||
|
|
81b1e19c4d | ||
|
|
5819705f54 | ||
|
|
5b2b58cdf8 | ||
|
|
c5430c18cb | ||
|
|
ca12fc3954 | ||
|
|
20c6fccb2c | ||
|
|
766a8c188b | ||
|
|
2f29ba9452 | ||
|
|
98ca09730a | ||
|
|
d5c4e58ca0 | ||
|
|
0cbb51d933 | ||
|
|
2b6f7e0708 | ||
|
|
4b40658fb5 | ||
|
|
08ebc6574d | ||
|
|
78f041d674 | ||
|
|
4db15d21cf | ||
|
|
7dcc6e0ea3 | ||
|
|
ec3c5b8351 | ||
|
|
be379b2ba9 | ||
|
|
cb2dba5323 | ||
|
|
d76675a66a | ||
|
|
9b7fccdd53 | ||
|
|
293f38b232 | ||
|
|
46506d5a4e | ||
|
|
73551a1a3d | ||
|
|
40c8ecf920 | ||
|
|
070497149d | ||
|
|
d5e54790f5 | ||
|
|
7ee991f6d6 | ||
|
|
7b7a0126d2 | ||
|
|
24e04dd3a3 | ||
|
|
567a3692cf | ||
|
|
eba5330122 | ||
|
|
093181f23e | ||
|
|
5dd0c33552 | ||
|
|
22d4ab414a | ||
|
|
e4faef661c | ||
|
|
05236e188c | ||
|
|
4977c34b5f | ||
|
|
6445aa4783 | ||
|
|
71cf2cd646 | ||
|
|
7502bab1c0 | ||
|
|
95724b4ddc | ||
|
|
d9ae6c0989 | ||
|
|
66e1fdd8a8 | ||
|
|
78c7cbf3ec | ||
|
|
efb8a1703e | ||
|
|
7765787876 | ||
|
|
09bbce1780 | ||
|
|
161f23f2c3 | ||
|
|
1f6d21a1a0 | ||
|
|
5678815237 | ||
|
|
9959d86a44 | ||
|
|
5f8cc12b50 | ||
|
|
6851f94caa | ||
|
|
0394f22965 | ||
|
|
77f406d06d | ||
|
|
693a6dd2c4 | ||
|
|
133a0e77f4 | ||
|
|
7d0b6274f1 | ||
|
|
c1e2b2e0cd | ||
|
|
e1653cf092 | ||
|
|
c7983aadb3 | ||
|
|
7efe045548 | ||
|
|
4b10b9486d | ||
|
|
4f19baab50 | ||
|
|
2d08416f5e | ||
|
|
29b8a6056e | ||
|
|
b6d023d528 | ||
|
|
d966269444 | ||
|
|
68cc38f14f | ||
|
|
7db25b96b9 | ||
|
|
2a7ad3dd9a | ||
|
|
201037eeb6 | ||
|
|
c834416b98 | ||
|
|
7b474b06ef | ||
|
|
780175e3de | ||
|
|
c906a7d33a | ||
|
|
b010cba9fc | ||
|
|
e561054b6f | ||
|
|
9c0477da5c | ||
|
|
d42219873d | ||
|
|
7c1373624f | ||
|
|
91b8f57154 | ||
|
|
bc9b2b8e9c | ||
|
|
74c5cbb605 | ||
|
|
ce9d241d05 | ||
|
|
98081352ea | ||
|
|
a02de3a20f | ||
|
|
5eff8c483c | ||
|
|
7e594aa3cb | ||
|
|
c60967cd4a | ||
|
|
e0fc034998 | ||
|
|
458f5a2562 | ||
|
|
0a5054efc1 | ||
|
|
2417d8fe28 | ||
|
|
3f96938143 | ||
|
|
27787d3300 | ||
|
|
56bf10b47f | ||
|
|
3a08058467 | ||
|
|
0c3e8de069 | ||
|
|
98d3fdb3c3 | ||
|
|
b3b0b620bf | ||
|
|
8c63db07ab | ||
|
|
1a379ca8e9 | ||
|
|
9ab67b2af5 | ||
|
|
ff682aedc3 | ||
|
|
4dfac221e1 | ||
|
|
aef226d3ab | ||
|
|
3fd749fd2f | ||
|
|
4c62c9b1ec | ||
|
|
3d04398b7c | ||
|
|
3c5e239985 | ||
|
|
d3c83c4c7d | ||
|
|
ae137c498a | ||
|
|
fd6f5b5390 | ||
|
|
4050e638f0 | ||
|
|
eb72d42eb2 | ||
|
|
ddd9cd4d26 | ||
|
|
17914f193d | ||
|
|
a9fc2c178a | ||
|
|
51d34b2732 | ||
|
|
537c23dfaf | ||
|
|
09855d7da1 | ||
|
|
02093641ca | ||
|
|
750559bf4c | ||
|
|
c756a60192 | ||
|
|
801e0e9995 | ||
|
|
b37ed47032 | ||
|
|
f974b7e2d0 | ||
|
|
50ff30eb62 | ||
|
|
597d1a91f1 | ||
|
|
02e6961b06 | ||
|
|
35203f0d42 | ||
|
|
eeb0f904d1 | ||
|
|
337fcbcfc1 | ||
|
|
9ee6977fe5 | ||
|
|
4b2d352c0d | ||
|
|
d865f88d92 | ||
|
|
fcd4671ec4 | ||
|
|
1eacdfe939 | ||
|
|
da50bd6dbd | ||
|
|
10ac9e0cd7 | ||
|
|
5f18a1eecd | ||
|
|
e073739ee5 | ||
|
|
202da2a061 | ||
|
|
49a52425c5 | ||
|
|
48393c72ed | ||
|
|
4423154a3f | ||
|
|
8673d67720 | ||
|
|
dfcb839f0e | ||
|
|
2632ecb1f9 | ||
|
|
99b39f3eed | ||
|
|
9d1526a28e | ||
|
|
204149745e | ||
|
|
6d4a43b417 | ||
|
|
913ead63d8 | ||
|
|
76b6d9e557 | ||
|
|
ef219ed6f8 | ||
|
|
9c5d40cbb9 | ||
|
|
380dc0f343 | ||
|
|
9223a1023e | ||
|
|
8057d75a52 | ||
|
|
faab99a8ce | ||
|
|
787cb90ff2 | ||
|
|
9db7a4db25 | ||
|
|
04d23f3849 | ||
|
|
8449bb928f | ||
|
|
006c798a0c | ||
|
|
2fc863bb79 | ||
|
|
64c39c2c21 | ||
|
|
f1bd49efb2 | ||
|
|
ae43f79e42 | ||
|
|
424b344645 | ||
|
|
cc9c7ec0ea |
17
.eslintrc.js
@@ -29,16 +29,15 @@ module.exports = {
|
||||
}
|
||||
],
|
||||
'vue/max-attributes-per-line': [
|
||||
'error',
|
||||
{
|
||||
'singleline': {
|
||||
'max': 1
|
||||
},
|
||||
'multiline': {
|
||||
'max': 1
|
||||
2,
|
||||
{
|
||||
singleline: 10,
|
||||
multiline: {
|
||||
max: 1,
|
||||
allowFirstLine: true
|
||||
}
|
||||
},
|
||||
],
|
||||
}
|
||||
],
|
||||
'vue/singleline-html-element-content-newline': 'off',
|
||||
'vue/multiline-html-element-content-newline': 'off',
|
||||
'vue/require-v-for-key': 'off',
|
||||
|
||||
7
App.vue
@@ -13,6 +13,11 @@
|
||||
</script>
|
||||
|
||||
<style lang='scss'>
|
||||
@import "uview-ui/index.scss";
|
||||
/*每个页面公共css */
|
||||
@import "@/static/styles/main.css";
|
||||
@import "uview-ui/index.scss";
|
||||
|
||||
page {
|
||||
background-color: #F8F8F8;
|
||||
}
|
||||
</style>
|
||||
|
||||
56
components/certifiedCj/certifiedCj.vue
Normal file
@@ -0,0 +1,56 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="xw_content" v-for="(item,index) in cjsList" :key="index" @click="clickCj(item)">
|
||||
<u--image :src="imgUrl+item.cover" width="112rpx" height="112rpx" :lazy-load="true">
|
||||
</u--image>
|
||||
<view class="xw_right">
|
||||
<view class="xw_title">
|
||||
{{item.name}}
|
||||
</view>
|
||||
<view style="display: flex;">
|
||||
<!-- <text class="cj_tags" v-for="(tagsItem,tagsIndex) in item.tags" :key="tagsIndex">
|
||||
{{tagsItem.tag}}
|
||||
</text> -->
|
||||
<text class="cj_tags">{{item.tag}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
cjsList: [],
|
||||
imgUrl: '',
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
this.getCertifiedCj()
|
||||
},
|
||||
methods: {
|
||||
// 获取认证厂家列表
|
||||
getCertifiedCj() {
|
||||
this.$apiServe.getCertifiedCj({
|
||||
pageSize: 2,
|
||||
pageNum: 1
|
||||
}).then(res => {
|
||||
// console.log('认证厂家', res.data.data)
|
||||
this.cjsList = res.data.data
|
||||
}).finally(_ => {})
|
||||
},
|
||||
// 跳转到认证厂家详情页
|
||||
clickCj(item) {
|
||||
uni.navigateTo({
|
||||
url: '../../packageReport/certifiedCjDetail/certifiedCjDetail?id=' + item.id
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
143
components/cityPicker/cityPicker.vue
Normal file
@@ -0,0 +1,143 @@
|
||||
<template>
|
||||
<view>
|
||||
<u-picker :show="show" ref="uPicker" :columns="cityList" @confirm="confirm" @change="changeHandler"
|
||||
@cancel="cancel"></u-picker>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { cityData } from '@/utills/city.js'
|
||||
export default {
|
||||
name: "cityPicker",
|
||||
props: {
|
||||
showPicker: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
cityData,
|
||||
//显示选择器
|
||||
show: false,
|
||||
// 打开选择器显示默认城市
|
||||
cityList: [],
|
||||
cityLevel1: [],
|
||||
cityLevel2: [],
|
||||
cityLevel3: [],
|
||||
cityLevelCode1: [],
|
||||
cityLevelCode2: [],
|
||||
cityLevelCode3: []
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
showPicker: {
|
||||
handler(val) {
|
||||
console.log(val)
|
||||
this.show = this.showPicker
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
show: {
|
||||
handler(val) {
|
||||
if(val) {
|
||||
this.cityList = [],
|
||||
this.cityLevel1 = [],
|
||||
this.cityLevel2 = [],
|
||||
this.cityLevel3 = [],
|
||||
this.cityLevelCode1 = []
|
||||
this.cityLevelCode2 = []
|
||||
this.cityLevelCode3 = []
|
||||
this.initCityData();
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
// 城市选择器初始化
|
||||
this.initCityData();
|
||||
},
|
||||
methods: {
|
||||
initCityData() {
|
||||
// 遍历城市js
|
||||
this.cityData.forEach((item1, index1) => {
|
||||
let temp2 = [];
|
||||
let code2 = [];
|
||||
this.cityLevel1.push(item1.provinceName);
|
||||
this.cityLevelCode1.push(item1.provinceCode);
|
||||
|
||||
let temp4 = [];
|
||||
let temp3 = [];
|
||||
let code4 = [];
|
||||
let code3 = [];
|
||||
// 遍历市
|
||||
item1.cities.forEach((item2, index2) => {
|
||||
temp2.push(item2.cityName);
|
||||
code2.push(item2.cityCode);
|
||||
// 遍历区
|
||||
item2.counties.forEach((item3, index3) => {
|
||||
temp3.push(item3.countyName);
|
||||
code3.push(item3.countyCode);
|
||||
})
|
||||
temp4[index2] = temp3;
|
||||
temp3 = [];
|
||||
code4[index2] = code3;
|
||||
code3 = [];
|
||||
})
|
||||
this.cityLevel3[index1] = temp4;
|
||||
|
||||
this.cityLevelCode3[index1] = code4;
|
||||
|
||||
this.cityLevel2[index1] = temp2;
|
||||
|
||||
this.cityLevelCode2[index1] = code2;
|
||||
})
|
||||
// 选择器默认城市
|
||||
this.cityList.push(this.cityLevel1, this.cityLevel2[0], this.cityLevel3[0][0]);
|
||||
},
|
||||
// 选中时执行
|
||||
changeHandler(e) {
|
||||
console.log(e)
|
||||
const {
|
||||
columnIndex,
|
||||
index,
|
||||
indexs,
|
||||
value,
|
||||
values,
|
||||
// 微信小程序无法将picker实例传出来,只能通过ref操作
|
||||
picker = this.$refs.uPicker
|
||||
} = e;
|
||||
if (columnIndex === 0) { // 选择第一列数据时
|
||||
// 设置第二列关联数据
|
||||
picker.setColumnValues(1, this.cityLevel2[index]);
|
||||
// 设置第三列关联数据
|
||||
picker.setColumnValues(2, this.cityLevel3[index][columnIndex]);
|
||||
} else if (columnIndex === 1) { // 选择第二列数据时
|
||||
// 设置第三列关联数据
|
||||
picker.setColumnValues(2, this.cityLevel3[indexs[0]][index]);
|
||||
}
|
||||
},
|
||||
// 单击确认按钮时执行
|
||||
confirm(e) {
|
||||
// 输出数组 [省, 市, 区]
|
||||
console.log(e);
|
||||
console.log(this.cityLevelCode3);
|
||||
console.log(this.cityLevel3);
|
||||
const code = this.cityLevelCode3[e.indexs[0]][e.indexs[1]][e.indexs[2]];
|
||||
console.log(code);
|
||||
this.$emit('confirm', [e.value, code]);
|
||||
// 隐藏城市选择器
|
||||
this.show = false;
|
||||
},
|
||||
cancel() {
|
||||
this.$emit('cancel')
|
||||
this.show = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
111
components/myAvatar/myAvatar.vue
Normal file
@@ -0,0 +1,111 @@
|
||||
<template>
|
||||
<view class="my_avatar">
|
||||
<view style="border-radius: 50rpx;">
|
||||
<u-avatar :src="avatar" size="100rpx" shape="circle" @click="changeAvatar()"></u-avatar>
|
||||
</view>
|
||||
<view style="margin-top: 10rpx;margin-bottom: 4rpx;">
|
||||
<u--image v-if="member=='2'||member=='3'" :src="normal" width="84rpx" height="30rpx">
|
||||
</u--image>
|
||||
<u--image v-if="member=='4'" :src="VIP" width="84rpx" height="30rpx">
|
||||
</u--image>
|
||||
</view>
|
||||
<view style="display: flex;align-items: center;">
|
||||
<text @click="changeAvatar()" style="color: #fff;font-size: 26rpx;">{{nickname}}</text>
|
||||
<u--image v-if="showEdit==true" src="/static/my/wd_icon_bj.png" width="22rpx" height="22rpx"
|
||||
@click="changeAvatar()">
|
||||
</u--image>
|
||||
</view>
|
||||
<view style="margin:0 20rpx;">
|
||||
<u-overlay :show="!isLoad">
|
||||
<login :timoutText="timoutText" @success="reOnLoad()" @fail="failToLoad()"></login>
|
||||
</u-overlay>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import login from 'pages/my/login/login'
|
||||
export default {
|
||||
name: "myAvatar",
|
||||
props: {
|
||||
center: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
components: {
|
||||
login
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
member: '',
|
||||
showEdit: true,
|
||||
avatar: '',
|
||||
nickname: '用户',
|
||||
normal: '/static/my/wo_icon_pthy.png',
|
||||
VIP: '/static/my/wo_icon_vip.png',
|
||||
isLoad: true,
|
||||
timoutText: 1
|
||||
};
|
||||
},
|
||||
created() {
|
||||
if (this.center != false) {
|
||||
this.showEdit = false
|
||||
}
|
||||
this.getUser()
|
||||
},
|
||||
options: {
|
||||
styleIsolation: 'shared', // 解除样式隔离
|
||||
},
|
||||
methods: {
|
||||
//修改头像
|
||||
changeAvatar() {
|
||||
uni.navigateTo({
|
||||
url: '../../packageMy/changeAvatar/changeAvatar'
|
||||
})
|
||||
},
|
||||
//获取头像昵称和普通会员和VIP会员
|
||||
getUser() {
|
||||
this.$apiServe.getUser().then(res => {
|
||||
// if (res.data.msg === "登录超时,请重新登录") {
|
||||
// this.isLoad = false
|
||||
// }
|
||||
if (res.data.code === -1) {
|
||||
this.isLoad = false
|
||||
}
|
||||
var data = res.data.data
|
||||
console.log('data个人信息', data);
|
||||
if (data) {
|
||||
this.avatar = uni.getStorageSync('img_url') + data.avatar
|
||||
this.nickname = data.nickname
|
||||
this.member = data.member
|
||||
uni.setStorageSync('user_id', data.user_id)
|
||||
uni.setStorageSync('member', data.member)
|
||||
uni.setStorageSync('agreement', data.agreement)
|
||||
uni.setStorageSync('com_name', data.com_name)
|
||||
uni.setStorageSync('com_mobile', data.com_mobile)
|
||||
}
|
||||
}).finally(_ => {})
|
||||
},
|
||||
reOnLoad() {
|
||||
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
|
||||
this.$toast.warn('登录失败请重试')
|
||||
this.isLoad = false
|
||||
return
|
||||
}
|
||||
this.isLoad = true
|
||||
this.getUser()
|
||||
},
|
||||
failToLoad() {
|
||||
uni.navigateBack({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
/deep/.u-image {
|
||||
margin-left: 8rpx;
|
||||
}
|
||||
</style>
|
||||
47
components/myForm/myForm.vue
Normal file
@@ -0,0 +1,47 @@
|
||||
<template>
|
||||
<view>
|
||||
<u--form labelPosition="left" :model="model">
|
||||
<u-form-item label="公司名称" prop="userInfo.name" borderBottom>
|
||||
<u--input v-model="model.userInfo.name" border="none" placeholder="请输入您的名称"
|
||||
placeholderStyle="color: #CCCCCC;font-size: 24rpx;" :disabled="disabled"></u--input>
|
||||
</u-form-item>
|
||||
<u-form-item label="公司电话" prop="userInfo.phone" borderBottom>
|
||||
<u--input v-model="model.userInfo.phone" border="none" placeholder="请输入您的电话"
|
||||
placeholderStyle="color: #CCCCCC;font-size: 24rpx;" :disabled="disabled">
|
||||
</u--input>
|
||||
</u-form-item>
|
||||
</u--form>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "myForm",
|
||||
data() {
|
||||
return {
|
||||
disabled: false,
|
||||
model: {
|
||||
userInfo: {
|
||||
name: '',
|
||||
phone: '',
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
options: {
|
||||
styleIsolation: 'shared', // 解除样式隔离
|
||||
},
|
||||
created() {
|
||||
// if (uni.getStorageSync('com_mobile') && uni.getStorageSync('com_name')) {
|
||||
// this.model.userInfo.name = uni.getStorageSync('com_name')
|
||||
// this.model.userInfo.phone = uni.getStorageSync('com_mobile')
|
||||
// }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/deep/.u-input__content__field-wrapper__field {
|
||||
background-color: #fff !important;
|
||||
}
|
||||
</style>
|
||||
64
components/news/news.vue
Normal file
@@ -0,0 +1,64 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="xw_content" v-for="(item,index) in newsList" :key="index" @click="clickNews(item)">
|
||||
<u--image :src="imgUrl+item.cover" width="192rpx" height="122rpx" :lazy-load="true">
|
||||
</u--image>
|
||||
<view class="xw_right">
|
||||
<view class="xw_title">
|
||||
{{item.title}}
|
||||
</view>
|
||||
<view style="display: flex;">
|
||||
<text class="xw_time">
|
||||
{{item.pub_time_str}}
|
||||
</text>
|
||||
<text class="xw_time xw_place">
|
||||
{{item.pub_name}}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
dateFormat
|
||||
} from '../../utills/date.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
imgUrl: '',
|
||||
newsList: [],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
this.getNews()
|
||||
},
|
||||
methods: {
|
||||
getNews() {
|
||||
this.$apiServe.getNews({
|
||||
pageSize: 3,
|
||||
pageNum: 1
|
||||
}).then(res => {
|
||||
let newsData = res.data.data
|
||||
console.log('新闻', newsData);
|
||||
if (newsData) {
|
||||
for (const item of newsData) {
|
||||
item.pub_time_str = dateFormat(item.pub_time_str)
|
||||
}
|
||||
// newsData = newsData.slice(0, 3)
|
||||
this.newsList = newsData
|
||||
}
|
||||
|
||||
}).finally(_ => {})
|
||||
},
|
||||
// 跳转到新闻详情页
|
||||
clickNews(item) {
|
||||
uni.navigateTo({
|
||||
url: '../../packageReport/newsDetail/newsDetail?id=' + item.id
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
164
components/productsBtn/productsBtn.vue
Normal file
@@ -0,0 +1,164 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="products_box">
|
||||
<u-grid :border="false" col="2">
|
||||
<u-grid-item v-for="(item,index) in productList" :key="index">
|
||||
<u-image src="/static/products/sy_bb.png" width="354rpx" height="539rpx" :lazy-load="true">
|
||||
</u-image>
|
||||
<view class="bgContent" @click="toDetailPage(item)">
|
||||
<view>
|
||||
<u-image :src="imgUrl+item.cover" width="346rpx" height="320rpx" :lazy-load="true"
|
||||
@click="toDetailPage()">
|
||||
</u-image>
|
||||
<view class="img_tag">{{item.cate_name}}</view>
|
||||
</view>
|
||||
<view style="padding: 14rpx 24rpx 14rpx 16rpx;">
|
||||
<view class="title_box">
|
||||
<text class="title">{{item.name}}</text>
|
||||
<u-tag :text="item.tags" type="warning" shape="circle"></u-tag>
|
||||
</view>
|
||||
<view class="product_desc">
|
||||
{{item.title}}
|
||||
</view>
|
||||
<view class="releaseDate">
|
||||
<u-image src="/static/products/xp_icon_sjf.png" width="22rpx" height="22rpx"
|
||||
:lazy-load="true">
|
||||
</u-image>
|
||||
<text class="release">发布日期:</text>
|
||||
<text>{{item.create_time}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-button v-if="type==1" type="success" text="取消收藏" color="#0EBB5B" @click="cancelCollect(item)">
|
||||
</u-button>
|
||||
<u-button v-if="type==2" type="success" text="移除" color="#0EBB5B" @click="deleteProduct(item)">
|
||||
</u-button>
|
||||
</u-grid-item>
|
||||
</u-grid>
|
||||
<view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;"
|
||||
v-if="type==1&&productList.length==0">
|
||||
暂无更多收藏记录</view>
|
||||
<view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;"
|
||||
v-if="type==2&&productList.length==0">
|
||||
暂无更多浏览记录</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
dateFormatHistory
|
||||
} from '../../utills/date.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
productId: '',
|
||||
imgUrl: '',
|
||||
tagsArray: [],
|
||||
productList: [],
|
||||
content: '您确定移除吗?'
|
||||
}
|
||||
},
|
||||
props: {
|
||||
type: String
|
||||
},
|
||||
options: {
|
||||
styleIsolation: 'shared', // 解除样式隔离
|
||||
},
|
||||
created() {
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
this.getHistoryOrCollection()
|
||||
},
|
||||
methods: {
|
||||
//获取历史记录
|
||||
getHistoryOrCollection() {
|
||||
this.$apiServe.getHistoryOrCollection(this.type).then(res => {
|
||||
let data = res.data.data
|
||||
console.log('浏览记录或收藏', res.data);
|
||||
if (data) {
|
||||
for (const item of data) {
|
||||
let tag = item.tags
|
||||
if (tag) {
|
||||
this.tagsArray = tag.split(',')
|
||||
item.tags = this.tagsArray[0]
|
||||
}
|
||||
item.create_time = dateFormatHistory(item.create_time)
|
||||
}
|
||||
this.productList = data
|
||||
}
|
||||
}).finally(_ => {
|
||||
|
||||
})
|
||||
},
|
||||
//移除按钮
|
||||
deleteProduct(item) {
|
||||
var that = this
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '你确定要移除吗',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
that.$apiServe.deleteHistoryOrCollection(item.id).then(res => {
|
||||
if (res.data.code == 1) {
|
||||
that.$toast.warn('移除成功')
|
||||
}
|
||||
that.getHistoryOrCollection()
|
||||
}).finally(_ => {})
|
||||
} else if (res.cancel) {
|
||||
that.$toast.warn('取消移除')
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
//取消收藏按钮
|
||||
cancelCollect(item) {
|
||||
var that = this
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '你确定要取消收藏吗',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
that.$apiServe.deleteHistoryOrCollection(item.id).then(res => {
|
||||
if (res.data.code == 1) {
|
||||
that.$toast.warn('取消收藏成功')
|
||||
}
|
||||
that.getHistoryOrCollection()
|
||||
}).finally(_ => {})
|
||||
} else if (res.cancel) {
|
||||
that.$toast.warn('取消操作')
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
//点击图片跳转到详情页
|
||||
toDetailPage(item) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/detail/productsDetail/productsDetail?id=' + item.product_id
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.u-modal__content {
|
||||
padding: 43rpx 104rpx !important;
|
||||
text-indent: 25rpx;
|
||||
}
|
||||
|
||||
.u-button {
|
||||
width: 150rpx !important;
|
||||
height: 50rpx !important;
|
||||
background: #0EBB5B;
|
||||
border-radius: 10rpx !important;
|
||||
margin-top: 22rpx;
|
||||
margin-bottom: 50rpx;
|
||||
}
|
||||
|
||||
.u-button__text {
|
||||
font-size: 24rpx !important;
|
||||
font-weight: 400;
|
||||
color: #FFFFFF;
|
||||
line-height: 33px;
|
||||
}
|
||||
</style>
|
||||
93
components/productsByThumb/productsByThumb.vue
Normal file
@@ -0,0 +1,93 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="products_box">
|
||||
<u-grid :border="false" col="2">
|
||||
<u-grid-item v-for="(item,index) in productList" :key="index" @click="toDetailPage(item)">
|
||||
<u-image src="/static/products/sy_bb.png" width="354rpx" height="539rpx" :lazy-load="true">
|
||||
</u-image>
|
||||
<view class="bgContent">
|
||||
<view>
|
||||
<u-image :src="imgUrl+item.cover" width="346rpx" height="320rpx" :lazy-load="true">
|
||||
</u-image>
|
||||
<view class="img_tag">{{item.cate_name}}</view>
|
||||
</view>
|
||||
<view style="padding: 14rpx 24rpx 14rpx 16rpx;">
|
||||
<view class="title_box">
|
||||
<text class="title">{{item.name}}</text>
|
||||
<u-tag :text="item.tags" type="warning" shape="circle"></u-tag>
|
||||
</view>
|
||||
<view class="product_desc">
|
||||
{{item.title}}
|
||||
</view>
|
||||
<view class="releaseDate">
|
||||
<u-image src="/static/products/xp_icon_sjf.png" width="22rpx" height="22rpx"
|
||||
:lazy-load="true">
|
||||
</u-image>
|
||||
<text class="release">发布日期:</text>
|
||||
<text>{{item.pub_time_str}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-grid-item>
|
||||
</u-grid>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
imgUrl: '',
|
||||
tagsArray: [],
|
||||
productList: [],
|
||||
pageNum: 1, // 当前页
|
||||
pageSize: 4, // 每页条数
|
||||
}
|
||||
},
|
||||
props: {
|
||||
reportPageSize: String
|
||||
},
|
||||
created() {
|
||||
// uni.$on("getCurrent", data => {
|
||||
// if (data == 0) {
|
||||
// this.sortType = 1
|
||||
// } else if (data == 1) {
|
||||
// this.sortType = 2
|
||||
// }
|
||||
// })
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
if (this.reportPageSize == 6) {
|
||||
this.pageSize = this.reportPageSize
|
||||
}
|
||||
this.getProductsByThumb()
|
||||
},
|
||||
methods: {
|
||||
//获取按点赞量排列的产品列表
|
||||
getProductsByThumb() {
|
||||
this.$apiServe.getProductsByCateId({
|
||||
cateId: '9',
|
||||
pageSize: this.pageSize,
|
||||
pageNum: this.pageNum
|
||||
}).then(res => {
|
||||
let tags = res.data.data
|
||||
console.log('企业需求列表', tags);
|
||||
for (const item of tags) {
|
||||
let tag = item.tags
|
||||
this.tagsArray = tag.split(',')
|
||||
item.tags = this.tagsArray[0]
|
||||
}
|
||||
this.$emit("getThumbLength", tags.length);
|
||||
// 用于触底刷新 为数据赋值:通过展开运算符的形式,进行新旧数据的拼接
|
||||
this.productList = [...this.productList, ...res.data.data]
|
||||
//这用于上架时间和点赞量的数据切换
|
||||
// this.productList = res.data.data
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
</style>
|
||||
92
components/productsByTime/productsByTime.vue
Normal file
@@ -0,0 +1,92 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="products_box">
|
||||
<u-grid :border="false" col="2">
|
||||
<u-grid-item v-for="(item,index) in productList" :key="index" @click="toDetailPage(item)">
|
||||
<u-image src="/static/products/sy_bb.png" width="354rpx" height="539rpx" :lazy-load="true">
|
||||
</u-image>
|
||||
<view class="bgContent">
|
||||
<view>
|
||||
<u-image :src="imgUrl+item.cover" width="346rpx" height="320rpx" :lazy-load="true">
|
||||
</u-image>
|
||||
<view class="img_tag">{{item.cate_name}}</view>
|
||||
</view>
|
||||
<view style="padding: 14rpx 24rpx 14rpx 16rpx;">
|
||||
<view class="title_box">
|
||||
<text class="title">{{item.name}}</text>
|
||||
<u-tag :text="item.tags" type="warning" shape="circle"></u-tag>
|
||||
</view>
|
||||
<view class="product_desc">
|
||||
{{item.title}}
|
||||
</view>
|
||||
<view class="releaseDate">
|
||||
<u-image src="/static/products/xp_icon_sjf.png" width="22rpx" height="22rpx"
|
||||
:lazy-load="true">
|
||||
</u-image>
|
||||
<text class="release">发布日期:</text>
|
||||
<text>{{item.pub_time_str}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-grid-item>
|
||||
</u-grid>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
imgUrl: null,
|
||||
tagsArray: [],
|
||||
productList: [],
|
||||
pageNum: 1, // 当前页
|
||||
pageSize: 4, // 每页条数
|
||||
// sortType: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
this.getProductsByTime()
|
||||
},
|
||||
methods: {
|
||||
//获取按上架时间排列的产品列表
|
||||
getProductsByTime() {
|
||||
this.$apiServe.getProducts({
|
||||
sortType: 1,
|
||||
pageSize: this.pageSize,
|
||||
pageNum: this.pageNum
|
||||
}).then(res => {
|
||||
console.log('产品列表1', res.data);
|
||||
let tags = res.data.data
|
||||
if (tags) {
|
||||
for (const item of tags) {
|
||||
let tag = item.tags
|
||||
this.tagsArray = tag.split(',')
|
||||
item.tags = this.tagsArray[0]
|
||||
}
|
||||
this.$emit("getTimeLength", tags.length);
|
||||
// 用于触底刷新 为数据赋值:通过展开运算符的形式,进行新旧数据的拼接
|
||||
this.productList = [...this.productList, ...res.data.data]
|
||||
//这用于上架时间和点赞量的数据切换
|
||||
// this.productList = res.data.data
|
||||
}
|
||||
|
||||
}).finally(_ => {
|
||||
|
||||
})
|
||||
},
|
||||
//点击图片跳转到详情页
|
||||
toDetailPage(item) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/detail/productsDetail/productsDetail?id=' + item.id
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
</style>
|
||||
27
components/u-parse/components/wxParseAudio.vue
Normal file
@@ -0,0 +1,27 @@
|
||||
<template>
|
||||
<!--增加audio标签支持-->
|
||||
<audio
|
||||
:id="node.attr.id"
|
||||
:class="node.classStr"
|
||||
:style="node.styleStr"
|
||||
:src="node.attr.src"
|
||||
:loop="node.attr.loop"
|
||||
:poster="node.attr.poster"
|
||||
:name="node.attr.name"
|
||||
:author="node.attr.author"
|
||||
controls></audio>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'wxParseAudio',
|
||||
props: {
|
||||
node: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
86
components/u-parse/components/wxParseImg.vue
Normal file
@@ -0,0 +1,86 @@
|
||||
<template>
|
||||
<image
|
||||
:mode="node.attr.mode"
|
||||
:lazy-load="node.attr.lazyLoad"
|
||||
:class="node.classStr"
|
||||
:style="newStyleStr || node.styleStr"
|
||||
:data-src="node.attr.src"
|
||||
:src="node.attr.src"
|
||||
@tap="wxParseImgTap"
|
||||
@load="wxParseImgLoad"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'wxParseImg',
|
||||
data() {
|
||||
return {
|
||||
newStyleStr: '',
|
||||
preview: true,
|
||||
};
|
||||
},
|
||||
props: {
|
||||
node: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
wxParseImgTap(e) {
|
||||
if (!this.preview) return;
|
||||
const { src } = e.currentTarget.dataset;
|
||||
if (!src) return;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {// TODO 遍历获取父节点执行方法
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.preview(src, e);
|
||||
},
|
||||
// 图片视觉宽高计算函数区
|
||||
wxParseImgLoad(e) {
|
||||
const { src } = e.currentTarget.dataset;
|
||||
if (!src) return;
|
||||
const { width, height } = e.mp.detail;
|
||||
const recal = this.wxAutoImageCal(width, height);
|
||||
const { imageheight, imageWidth } = recal;
|
||||
const { padding, mode } = this.node.attr;
|
||||
const { styleStr } = this.node;
|
||||
const imageHeightStyle = mode === 'widthFix' ? '' : `height: ${imageheight}px;`;
|
||||
this.newStyleStr = `${styleStr}; ${imageHeightStyle}; width: ${imageWidth}px; padding: 0 ${+padding}px;`;
|
||||
},
|
||||
// 计算视觉优先的图片宽高
|
||||
wxAutoImageCal(originalWidth, originalHeight) {
|
||||
// 获取图片的原始长宽
|
||||
const { padding } = this.node.attr;
|
||||
const windowWidth = this.node.$screen.width - (2 * padding);
|
||||
const results = {};
|
||||
|
||||
if (originalWidth < 60 || originalHeight < 60) {
|
||||
const { src } = this.node.attr;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.removeImageUrl(src);
|
||||
this.preview = false;
|
||||
}
|
||||
|
||||
// 判断按照那种方式进行缩放
|
||||
if (originalWidth > windowWidth) {
|
||||
// 在图片width大于手机屏幕width时候
|
||||
results.imageWidth = windowWidth;
|
||||
results.imageheight = windowWidth * (originalHeight / originalWidth);
|
||||
} else {
|
||||
// 否则展示原来的数据
|
||||
results.imageWidth = originalWidth;
|
||||
results.imageheight = originalHeight;
|
||||
}
|
||||
|
||||
return results;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
107
components/u-parse/components/wxParseTemplate0.vue
Normal file
@@ -0,0 +1,107 @@
|
||||
<template>
|
||||
<view>
|
||||
<!--判断是否是标签节点-->
|
||||
<block v-if="node.node == 'element'">
|
||||
<block v-if="node.tag == 'button'">
|
||||
<button type="default" size="mini">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</button>
|
||||
</block>
|
||||
|
||||
<!--li类型-->
|
||||
<block v-else-if="node.tag == 'li'">
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--video类型-->
|
||||
<block v-else-if="node.tag == 'video'">
|
||||
<wx-parse-video :node="node" />
|
||||
</block>
|
||||
|
||||
<!--audio类型-->
|
||||
<block v-else-if="node.tag == 'audio'">
|
||||
<wx-parse-audio :node="node" />
|
||||
</block>
|
||||
|
||||
<!--img类型-->
|
||||
<block v-else-if="node.tag == 'img'">
|
||||
<wx-parse-img :node="node" />
|
||||
</block>
|
||||
|
||||
<!--a类型-->
|
||||
<block v-else-if="node.tag == 'a'">
|
||||
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--table类型-->
|
||||
<block v-else-if="node.tag == 'table'">
|
||||
<view :class="node.classStr" class="table" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--br类型-->
|
||||
<block v-else-if="node.tag == 'br'">
|
||||
<text>\n</text>
|
||||
</block>
|
||||
|
||||
<!--其他标签-->
|
||||
<block v-else>
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</block>
|
||||
|
||||
<!--判断是否是文本节点-->
|
||||
<block v-else-if="node.node == 'text'">{{node.text}}</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wxParseTemplate from './wxParseTemplate1';
|
||||
import wxParseImg from './wxParseImg';
|
||||
import wxParseVideo from './wxParseVideo';
|
||||
import wxParseAudio from './wxParseAudio';
|
||||
|
||||
export default {
|
||||
name: 'wxParseTemplate0',
|
||||
props: {
|
||||
node: {},
|
||||
},
|
||||
components: {
|
||||
wxParseTemplate,
|
||||
wxParseImg,
|
||||
wxParseVideo,
|
||||
wxParseAudio,
|
||||
},
|
||||
methods: {
|
||||
wxParseATap(e) {
|
||||
const {
|
||||
href
|
||||
} = e.currentTarget.dataset;// TODO currentTarget才有dataset
|
||||
if (!href) return;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {// TODO 遍历获取父节点执行方法
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.navigate(href, e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
99
components/u-parse/components/wxParseTemplate1.vue
Normal file
@@ -0,0 +1,99 @@
|
||||
<template>
|
||||
<view :class="(node.tag == 'li' ? node.classStr : (node.node==='text'?'text':''))">
|
||||
<!--判断是否是标签节点-->
|
||||
<block v-if="node.node == 'element'">
|
||||
<block v-if="node.tag == 'button'">
|
||||
<button type="default" size="mini">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</button>
|
||||
</block>
|
||||
|
||||
<!--li类型-->
|
||||
<block v-else-if="node.tag == 'li'">
|
||||
<!-- <view :class="node.classStr" :style="node.styleStr"> -->
|
||||
<view :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--video类型-->
|
||||
<block v-else-if="node.tag == 'video'">
|
||||
<wx-parse-video :node="node" />
|
||||
</block>
|
||||
|
||||
<!--audio类型-->
|
||||
<block v-else-if="node.tag == 'audio'">
|
||||
<wx-parse-audio :node="node" />
|
||||
</block>
|
||||
|
||||
<!--img类型-->
|
||||
<block v-else-if="node.tag == 'img'">
|
||||
<wx-parse-img :node="node" />
|
||||
</block>
|
||||
|
||||
<!--a类型-->
|
||||
<block v-else-if="node.tag == 'a'">
|
||||
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--br类型-->
|
||||
<block v-else-if="node.tag == 'br'">
|
||||
<text>\n</text>
|
||||
</block>
|
||||
|
||||
<!--其他标签-->
|
||||
<block v-else>
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</block>
|
||||
|
||||
<!--判断是否是文本节点-->
|
||||
<block v-else-if="node.node == 'text'">{{node.text}}</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wxParseTemplate from './wxParseTemplate2';
|
||||
import wxParseImg from './wxParseImg';
|
||||
import wxParseVideo from './wxParseVideo';
|
||||
import wxParseAudio from './wxParseAudio';
|
||||
|
||||
export default {
|
||||
name: 'wxParseTemplate1',
|
||||
props: {
|
||||
node: {},
|
||||
},
|
||||
components: {
|
||||
wxParseTemplate,
|
||||
wxParseImg,
|
||||
wxParseVideo,
|
||||
wxParseAudio,
|
||||
},
|
||||
methods: {
|
||||
wxParseATap(e) {
|
||||
const {
|
||||
href
|
||||
} = e.currentTarget.dataset;
|
||||
if (!href) return;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.navigate(href, e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
97
components/u-parse/components/wxParseTemplate10.vue
Normal file
@@ -0,0 +1,97 @@
|
||||
<template>
|
||||
<view>
|
||||
<!--判断是否是标签节点-->
|
||||
<block v-if="node.node == 'element'">
|
||||
<block v-if="node.tag == 'button'">
|
||||
<button type="default" size="mini">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</button>
|
||||
</block>
|
||||
|
||||
<!--li类型-->
|
||||
<block v-else-if="node.tag == 'li'">
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--video类型-->
|
||||
<block v-else-if="node.tag == 'video'">
|
||||
<wx-parse-video :node="node" />
|
||||
</block>
|
||||
|
||||
<!--audio类型-->
|
||||
<block v-else-if="node.tag == 'audio'">
|
||||
<wx-parse-audio :node="node" />
|
||||
</block>
|
||||
|
||||
<!--img类型-->
|
||||
<block v-else-if="node.tag == 'img'">
|
||||
<wx-parse-img :node="node" />
|
||||
</block>
|
||||
|
||||
<!--a类型-->
|
||||
<block v-else-if="node.tag == 'a'">
|
||||
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--br类型-->
|
||||
<block v-else-if="node.tag == 'br'">
|
||||
<text>\n</text>
|
||||
</block>
|
||||
|
||||
<!--其他标签-->
|
||||
<block v-else>
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
</block>
|
||||
|
||||
<!--判断是否是文本节点-->
|
||||
<block v-else-if="node.node == 'text'">{{node.text}}</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wxParseTemplate from './wxParseTemplate11';
|
||||
import wxParseImg from './wxParseImg';
|
||||
import wxParseVideo from './wxParseVideo';
|
||||
import wxParseAudio from './wxParseAudio';
|
||||
|
||||
export default {
|
||||
name: 'wxParseTemplate10',
|
||||
props: {
|
||||
node: {},
|
||||
},
|
||||
components: {
|
||||
wxParseTemplate,
|
||||
wxParseImg,
|
||||
wxParseVideo,
|
||||
wxParseAudio,
|
||||
},
|
||||
methods: {
|
||||
wxParseATap(e) {
|
||||
const {
|
||||
href
|
||||
} = e.currentTarget.dataset;
|
||||
if (!href) return;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.navigate(href, e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
87
components/u-parse/components/wxParseTemplate11.vue
Normal file
@@ -0,0 +1,87 @@
|
||||
<template>
|
||||
<view>
|
||||
<!--判断是否是标签节点-->
|
||||
<block v-if="node.node == 'element'">
|
||||
<!--button类型-->
|
||||
<block v-if="node.tag == 'button'">
|
||||
<button type="default" size="mini">
|
||||
</button>
|
||||
</block>
|
||||
|
||||
<!--li类型-->
|
||||
<block v-else-if="node.tag == 'li'">
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
{{node.text}}
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--video类型-->
|
||||
<block v-else-if="node.tag == 'video'">
|
||||
<wx-parse-video :node="node" />
|
||||
</block>
|
||||
|
||||
<!--audio类型-->
|
||||
<block v-else-if="node.tag == 'audio'">
|
||||
<wx-parse-audio :node="node" />
|
||||
</block>
|
||||
|
||||
<!--img类型-->
|
||||
<block v-else-if="node.tag == 'img'">
|
||||
<wx-parse-img :node="node" />
|
||||
</block>
|
||||
|
||||
<!--a类型-->
|
||||
<block v-else-if="node.tag == 'a'">
|
||||
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
||||
{{node.text}}
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--br类型-->
|
||||
<block v-else-if="node.tag == 'br'">
|
||||
<text>\n</text>
|
||||
</block>
|
||||
|
||||
<!--其他标签-->
|
||||
<block v-else>
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
{{node.text}}
|
||||
</view>
|
||||
</block>
|
||||
</block>
|
||||
|
||||
<!--判断是否是文本节点-->
|
||||
<block v-else-if="node.node == 'text'">{{node.text}}</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wxParseImg from './wxParseImg';
|
||||
import wxParseVideo from './wxParseVideo';
|
||||
import wxParseAudio from './wxParseAudio';
|
||||
|
||||
export default {
|
||||
name: 'wxParseTemplate11',
|
||||
props: {
|
||||
node: {},
|
||||
},
|
||||
components: {
|
||||
wxParseImg,
|
||||
wxParseVideo,
|
||||
wxParseAudio,
|
||||
},
|
||||
methods: {
|
||||
wxParseATap(e) {
|
||||
const {
|
||||
href
|
||||
} = e.currentTarget.dataset;
|
||||
if (!href) return;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.navigate(href, e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
98
components/u-parse/components/wxParseTemplate2.vue
Normal file
@@ -0,0 +1,98 @@
|
||||
<template>
|
||||
<view>
|
||||
<!--判断是否是标签节点-->
|
||||
<block v-if="node.node == 'element'">
|
||||
<block v-if="node.tag == 'button'">
|
||||
<button type="default" size="mini">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</button>
|
||||
</block>
|
||||
|
||||
<!--li类型-->
|
||||
<block v-else-if="node.tag == 'li'">
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--video类型-->
|
||||
<block v-else-if="node.tag == 'video'">
|
||||
<wx-parse-video :node="node" />
|
||||
</block>
|
||||
|
||||
<!--audio类型-->
|
||||
<block v-else-if="node.tag == 'audio'">
|
||||
<wx-parse-audio :node="node" />
|
||||
</block>
|
||||
|
||||
<!--img类型-->
|
||||
<block v-else-if="node.tag == 'img'">
|
||||
<wx-parse-img :node="node" />
|
||||
</block>
|
||||
|
||||
<!--a类型-->
|
||||
<block v-else-if="node.tag == 'a'">
|
||||
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--br类型-->
|
||||
<block v-else-if="node.tag == 'br'">
|
||||
<text>\n</text>
|
||||
</block>
|
||||
|
||||
<!--其他标签-->
|
||||
<block v-else>
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</block>
|
||||
|
||||
<!--判断是否是文本节点-->
|
||||
<block v-else-if="node.node == 'text'">{{node.text}}</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wxParseTemplate from './wxParseTemplate3';
|
||||
import wxParseImg from './wxParseImg';
|
||||
import wxParseVideo from './wxParseVideo';
|
||||
import wxParseAudio from './wxParseAudio';
|
||||
|
||||
export default {
|
||||
name: 'wxParseTemplate2',
|
||||
props: {
|
||||
node: {},
|
||||
},
|
||||
components: {
|
||||
wxParseTemplate,
|
||||
wxParseImg,
|
||||
wxParseVideo,
|
||||
wxParseAudio,
|
||||
},
|
||||
methods: {
|
||||
wxParseATap(e) {
|
||||
const {
|
||||
href
|
||||
} = e.currentTarget.dataset;
|
||||
if (!href) return;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.navigate(href, e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
98
components/u-parse/components/wxParseTemplate3.vue
Normal file
@@ -0,0 +1,98 @@
|
||||
<template>
|
||||
<view>
|
||||
<!--判断是否是标签节点-->
|
||||
<block v-if="node.node == 'element'">
|
||||
<block v-if="node.tag == 'button'">
|
||||
<button type="default" size="mini">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</button>
|
||||
</block>
|
||||
|
||||
<!--li类型-->
|
||||
<block v-else-if="node.tag == 'li'">
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--video类型-->
|
||||
<block v-else-if="node.tag == 'video'">
|
||||
<wx-parse-video :node="node" />
|
||||
</block>
|
||||
|
||||
<!--audio类型-->
|
||||
<block v-else-if="node.tag == 'audio'">
|
||||
<wx-parse-audio :node="node" />
|
||||
</block>
|
||||
|
||||
<!--img类型-->
|
||||
<block v-else-if="node.tag == 'img'">
|
||||
<wx-parse-img :node="node" />
|
||||
</block>
|
||||
|
||||
<!--a类型-->
|
||||
<block v-else-if="node.tag == 'a'">
|
||||
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--br类型-->
|
||||
<block v-else-if="node.tag == 'br'">
|
||||
<text>\n</text>
|
||||
</block>
|
||||
|
||||
<!--其他标签-->
|
||||
<block v-else>
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</block>
|
||||
|
||||
<!--判断是否是文本节点-->
|
||||
<block v-else-if="node.node == 'text'">{{node.text}}</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wxParseTemplate from './wxParseTemplate4';
|
||||
import wxParseImg from './wxParseImg';
|
||||
import wxParseVideo from './wxParseVideo';
|
||||
import wxParseAudio from './wxParseAudio';
|
||||
|
||||
export default {
|
||||
name: 'wxParseTemplate3',
|
||||
props: {
|
||||
node: {},
|
||||
},
|
||||
components: {
|
||||
wxParseTemplate,
|
||||
wxParseImg,
|
||||
wxParseVideo,
|
||||
wxParseAudio,
|
||||
},
|
||||
methods: {
|
||||
wxParseATap(e) {
|
||||
const {
|
||||
href
|
||||
} = e.currentTarget.dataset;
|
||||
if (!href) return;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.navigate(href, e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
98
components/u-parse/components/wxParseTemplate4.vue
Normal file
@@ -0,0 +1,98 @@
|
||||
<template>
|
||||
<view>
|
||||
<!--判断是否是标签节点-->
|
||||
<block v-if="node.node == 'element'">
|
||||
<block v-if="node.tag == 'button'">
|
||||
<button type="default" size="mini">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</button>
|
||||
</block>
|
||||
|
||||
<!--li类型-->
|
||||
<block v-else-if="node.tag == 'li'">
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--video类型-->
|
||||
<block v-else-if="node.tag == 'video'">
|
||||
<wx-parse-video :node="node" />
|
||||
</block>
|
||||
|
||||
<!--audio类型-->
|
||||
<block v-else-if="node.tag == 'audio'">
|
||||
<wx-parse-audio :node="node" />
|
||||
</block>
|
||||
|
||||
<!--img类型-->
|
||||
<block v-else-if="node.tag == 'img'">
|
||||
<wx-parse-img :node="node" />
|
||||
</block>
|
||||
|
||||
<!--a类型-->
|
||||
<block v-else-if="node.tag == 'a'">
|
||||
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--br类型-->
|
||||
<block v-else-if="node.tag == 'br'">
|
||||
<text>\n</text>
|
||||
</block>
|
||||
|
||||
<!--其他标签-->
|
||||
<block v-else>
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</block>
|
||||
|
||||
<!--判断是否是文本节点-->
|
||||
<block v-else-if="node.node == 'text'">{{node.text}}</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wxParseTemplate from './wxParseTemplate5';
|
||||
import wxParseImg from './wxParseImg';
|
||||
import wxParseVideo from './wxParseVideo';
|
||||
import wxParseAudio from './wxParseAudio';
|
||||
|
||||
export default {
|
||||
name: 'wxParseTemplate4',
|
||||
props: {
|
||||
node: {},
|
||||
},
|
||||
components: {
|
||||
wxParseTemplate,
|
||||
wxParseImg,
|
||||
wxParseVideo,
|
||||
wxParseAudio,
|
||||
},
|
||||
methods: {
|
||||
wxParseATap(e) {
|
||||
const {
|
||||
href
|
||||
} = e.currentTarget.dataset;
|
||||
if (!href) return;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.navigate(href, e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
98
components/u-parse/components/wxParseTemplate5.vue
Normal file
@@ -0,0 +1,98 @@
|
||||
<template>
|
||||
<view>
|
||||
<!--判断是否是标签节点-->
|
||||
<block v-if="node.node == 'element'">
|
||||
<block v-if="node.tag == 'button'">
|
||||
<button type="default" size="mini">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</button>
|
||||
</block>
|
||||
|
||||
<!--li类型-->
|
||||
<block v-else-if="node.tag == 'li'">
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--video类型-->
|
||||
<block v-else-if="node.tag == 'video'">
|
||||
<wx-parse-video :node="node" />
|
||||
</block>
|
||||
|
||||
<!--audio类型-->
|
||||
<block v-else-if="node.tag == 'audio'">
|
||||
<wx-parse-audio :node="node" />
|
||||
</block>
|
||||
|
||||
<!--img类型-->
|
||||
<block v-else-if="node.tag == 'img'">
|
||||
<wx-parse-img :node="node" />
|
||||
</block>
|
||||
|
||||
<!--a类型-->
|
||||
<block v-else-if="node.tag == 'a'">
|
||||
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--br类型-->
|
||||
<block v-else-if="node.tag == 'br'">
|
||||
<text>\n</text>
|
||||
</block>
|
||||
|
||||
<!--其他标签-->
|
||||
<block v-else>
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</block>
|
||||
|
||||
<!--判断是否是文本节点-->
|
||||
<block v-else-if="node.node == 'text'">{{node.text}}</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wxParseTemplate from './wxParseTemplate6';
|
||||
import wxParseImg from './wxParseImg';
|
||||
import wxParseVideo from './wxParseVideo';
|
||||
import wxParseAudio from './wxParseAudio';
|
||||
|
||||
export default {
|
||||
name: 'wxParseTemplate5',
|
||||
props: {
|
||||
node: {},
|
||||
},
|
||||
components: {
|
||||
wxParseTemplate,
|
||||
wxParseImg,
|
||||
wxParseVideo,
|
||||
wxParseAudio,
|
||||
},
|
||||
methods: {
|
||||
wxParseATap(e) {
|
||||
const {
|
||||
href
|
||||
} = e.currentTarget.dataset;
|
||||
if (!href) return;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.navigate(href, e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
98
components/u-parse/components/wxParseTemplate6.vue
Normal file
@@ -0,0 +1,98 @@
|
||||
<template>
|
||||
<view>
|
||||
<!--判断是否是标签节点-->
|
||||
<block v-if="node.node == 'element'">
|
||||
<block v-if="node.tag == 'button'">
|
||||
<button type="default" size="mini">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</button>
|
||||
</block>
|
||||
|
||||
<!--li类型-->
|
||||
<block v-else-if="node.tag == 'li'">
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--video类型-->
|
||||
<block v-else-if="node.tag == 'video'">
|
||||
<wx-parse-video :node="node" />
|
||||
</block>
|
||||
|
||||
<!--audio类型-->
|
||||
<block v-else-if="node.tag == 'audio'">
|
||||
<wx-parse-audio :node="node" />
|
||||
</block>
|
||||
|
||||
<!--img类型-->
|
||||
<block v-else-if="node.tag == 'img'">
|
||||
<wx-parse-img :node="node" />
|
||||
</block>
|
||||
|
||||
<!--a类型-->
|
||||
<block v-else-if="node.tag == 'a'">
|
||||
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--br类型-->
|
||||
<block v-else-if="node.tag == 'br'">
|
||||
<text>\n</text>
|
||||
</block>
|
||||
|
||||
<!--其他标签-->
|
||||
<block v-else>
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</block>
|
||||
|
||||
<!--判断是否是文本节点-->
|
||||
<block v-else-if="node.node == 'text'">{{node.text}}</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wxParseTemplate from './wxParseTemplate7';
|
||||
import wxParseImg from './wxParseImg';
|
||||
import wxParseVideo from './wxParseVideo';
|
||||
import wxParseAudio from './wxParseAudio';
|
||||
|
||||
export default {
|
||||
name: 'wxParseTemplate6',
|
||||
props: {
|
||||
node: {},
|
||||
},
|
||||
components: {
|
||||
wxParseTemplate,
|
||||
wxParseImg,
|
||||
wxParseVideo,
|
||||
wxParseAudio,
|
||||
},
|
||||
methods: {
|
||||
wxParseATap(e) {
|
||||
const {
|
||||
href
|
||||
} = e.currentTarget.dataset;
|
||||
if (!href) return;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.navigate(href, e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
98
components/u-parse/components/wxParseTemplate7.vue
Normal file
@@ -0,0 +1,98 @@
|
||||
<template>
|
||||
<view>
|
||||
<!--判断是否是标签节点-->
|
||||
<block v-if="node.node == 'element'">
|
||||
<block v-if="node.tag == 'button'">
|
||||
<button type="default" size="mini">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</button>
|
||||
</block>
|
||||
|
||||
<!--li类型-->
|
||||
<block v-else-if="node.tag == 'li'">
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--video类型-->
|
||||
<block v-else-if="node.tag == 'video'">
|
||||
<wx-parse-video :node="node" />
|
||||
</block>
|
||||
|
||||
<!--audio类型-->
|
||||
<block v-else-if="node.tag == 'audio'">
|
||||
<wx-parse-audio :node="node" />
|
||||
</block>
|
||||
|
||||
<!--img类型-->
|
||||
<block v-else-if="node.tag == 'img'">
|
||||
<wx-parse-img :node="node" />
|
||||
</block>
|
||||
|
||||
<!--a类型-->
|
||||
<block v-else-if="node.tag == 'a'">
|
||||
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--br类型-->
|
||||
<block v-else-if="node.tag == 'br'">
|
||||
<text>\n</text>
|
||||
</block>
|
||||
|
||||
<!--其他标签-->
|
||||
<block v-else>
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</block>
|
||||
|
||||
<!--判断是否是文本节点-->
|
||||
<block v-else-if="node.node == 'text'">{{node.text}}</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wxParseTemplate from './wxParseTemplate8';
|
||||
import wxParseImg from './wxParseImg';
|
||||
import wxParseVideo from './wxParseVideo';
|
||||
import wxParseAudio from './wxParseAudio';
|
||||
|
||||
export default {
|
||||
name: 'wxParseTemplate7',
|
||||
props: {
|
||||
node: {},
|
||||
},
|
||||
components: {
|
||||
wxParseTemplate,
|
||||
wxParseImg,
|
||||
wxParseVideo,
|
||||
wxParseAudio,
|
||||
},
|
||||
methods: {
|
||||
wxParseATap(e) {
|
||||
const {
|
||||
href
|
||||
} = e.currentTarget.dataset;
|
||||
if (!href) return;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.navigate(href, e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
98
components/u-parse/components/wxParseTemplate8.vue
Normal file
@@ -0,0 +1,98 @@
|
||||
<template>
|
||||
<view>
|
||||
<!--判断是否是标签节点-->
|
||||
<block v-if="node.node == 'element'">
|
||||
<block v-if="node.tag == 'button'">
|
||||
<button type="default" size="mini">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</button>
|
||||
</block>
|
||||
|
||||
<!--li类型-->
|
||||
<block v-else-if="node.tag == 'li'">
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--video类型-->
|
||||
<block v-else-if="node.tag == 'video'">
|
||||
<wx-parse-video :node="node" />
|
||||
</block>
|
||||
|
||||
<!--audio类型-->
|
||||
<block v-else-if="node.tag == 'audio'">
|
||||
<wx-parse-audio :node="node" />
|
||||
</block>
|
||||
|
||||
<!--img类型-->
|
||||
<block v-else-if="node.tag == 'img'">
|
||||
<wx-parse-img :node="node" />
|
||||
</block>
|
||||
|
||||
<!--a类型-->
|
||||
<block v-else-if="node.tag == 'a'">
|
||||
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--br类型-->
|
||||
<block v-else-if="node.tag == 'br'">
|
||||
<text>\n</text>
|
||||
</block>
|
||||
|
||||
<!--其他标签-->
|
||||
<block v-else>
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</block>
|
||||
|
||||
<!--判断是否是文本节点-->
|
||||
<block v-else-if="node.node == 'text'">{{node.text}}</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wxParseTemplate from './wxParseTemplate9';
|
||||
import wxParseImg from './wxParseImg';
|
||||
import wxParseVideo from './wxParseVideo';
|
||||
import wxParseAudio from './wxParseAudio';
|
||||
|
||||
export default {
|
||||
name: 'wxParseTemplate8',
|
||||
props: {
|
||||
node: {},
|
||||
},
|
||||
components: {
|
||||
wxParseTemplate,
|
||||
wxParseImg,
|
||||
wxParseVideo,
|
||||
wxParseAudio,
|
||||
},
|
||||
methods: {
|
||||
wxParseATap(e) {
|
||||
const {
|
||||
href
|
||||
} = e.currentTarget.dataset;
|
||||
if (!href) return;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.navigate(href, e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
98
components/u-parse/components/wxParseTemplate9.vue
Normal file
@@ -0,0 +1,98 @@
|
||||
<template>
|
||||
<view>
|
||||
<!--判断是否是标签节点-->
|
||||
<block v-if="node.node == 'element'">
|
||||
<block v-if="node.tag == 'button'">
|
||||
<button type="default" size="mini">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</button>
|
||||
</block>
|
||||
|
||||
<!--li类型-->
|
||||
<block v-else-if="node.tag == 'li'">
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--video类型-->
|
||||
<block v-else-if="node.tag == 'video'">
|
||||
<wx-parse-video :node="node" />
|
||||
</block>
|
||||
|
||||
<!--audio类型-->
|
||||
<block v-else-if="node.tag == 'audio'">
|
||||
<wx-parse-audio :node="node" />
|
||||
</block>
|
||||
|
||||
<!--img类型-->
|
||||
<block v-else-if="node.tag == 'img'">
|
||||
<wx-parse-img :node="node" />
|
||||
</block>
|
||||
|
||||
<!--a类型-->
|
||||
<block v-else-if="node.tag == 'a'">
|
||||
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--br类型-->
|
||||
<block v-else-if="node.tag == 'br'">
|
||||
<text>\n</text>
|
||||
</block>
|
||||
|
||||
<!--其他标签-->
|
||||
<block v-else>
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</block>
|
||||
|
||||
<!--判断是否是文本节点-->
|
||||
<block v-else-if="node.node == 'text'">{{node.text}}</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wxParseTemplate from './wxParseTemplate10';
|
||||
import wxParseImg from './wxParseImg';
|
||||
import wxParseVideo from './wxParseVideo';
|
||||
import wxParseAudio from './wxParseAudio';
|
||||
|
||||
export default {
|
||||
name: 'wxParseTemplate9',
|
||||
props: {
|
||||
node: {},
|
||||
},
|
||||
components: {
|
||||
wxParseTemplate,
|
||||
wxParseImg,
|
||||
wxParseVideo,
|
||||
wxParseAudio,
|
||||
},
|
||||
methods: {
|
||||
wxParseATap(e) {
|
||||
const {
|
||||
href
|
||||
} = e.currentTarget.dataset;
|
||||
if (!href) return;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.navigate(href, e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
15
components/u-parse/components/wxParseVideo.vue
Normal file
@@ -0,0 +1,15 @@
|
||||
<template>
|
||||
<!--增加video标签支持,并循环添加-->
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<video :class="node.classStr" class="video-video" :src="node.attr.src"></video>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'wxParseVideo',
|
||||
props: {
|
||||
node: {},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
261
components/u-parse/libs/html2json.js
Normal file
@@ -0,0 +1,261 @@
|
||||
/**
|
||||
* html2Json 改造来自: https://github.com/Jxck/html2json
|
||||
*
|
||||
*
|
||||
* author: Di (微信小程序开发工程师)
|
||||
* organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
|
||||
* 垂直微信小程序开发交流社区
|
||||
*
|
||||
* github地址: https://github.com/icindy/wxParse
|
||||
*
|
||||
* for: 微信小程序富文本解析
|
||||
* detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
|
||||
*/
|
||||
|
||||
import wxDiscode from './wxDiscode';
|
||||
import HTMLParser from './htmlparser';
|
||||
|
||||
function makeMap(str) {
|
||||
const obj = {};
|
||||
const items = str.split(',');
|
||||
for (let i = 0; i < items.length; i += 1) obj[items[i]] = true;
|
||||
return obj;
|
||||
}
|
||||
|
||||
// Block Elements - HTML 5
|
||||
const block = makeMap('br,code,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video');
|
||||
|
||||
// Inline Elements - HTML 5
|
||||
const inline = makeMap('a,abbr,acronym,applet,b,basefont,bdo,big,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var');
|
||||
|
||||
// Elements that you can, intentionally, leave open
|
||||
// (and which close themselves)
|
||||
const closeSelf = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr');
|
||||
|
||||
function removeDOCTYPE(html) {
|
||||
const isDocument = /<body.*>([^]*)<\/body>/.test(html);
|
||||
return isDocument ? RegExp.$1 : html;
|
||||
}
|
||||
|
||||
function trimHtml(html) {
|
||||
return html
|
||||
.replace(/<!--.*?-->/gi, '')
|
||||
.replace(/\/\*.*?\*\//gi, '')
|
||||
.replace(/[ ]+</gi, '<')
|
||||
.replace(/<script[^]*<\/script>/gi, '')
|
||||
.replace(/<style[^]*<\/style>/gi, '');
|
||||
}
|
||||
|
||||
function getScreenInfo() {
|
||||
const screen = {};
|
||||
wx.getSystemInfo({
|
||||
success: (res) => {
|
||||
screen.width = res.windowWidth;
|
||||
screen.height = res.windowHeight;
|
||||
},
|
||||
});
|
||||
return screen;
|
||||
}
|
||||
|
||||
function html2json(html, customHandler, imageProp, host) {
|
||||
// 处理字符串
|
||||
html = removeDOCTYPE(html);
|
||||
html = trimHtml(html);
|
||||
html = wxDiscode.strDiscode(html);
|
||||
// 生成node节点
|
||||
const bufArray = [];
|
||||
const results = {
|
||||
nodes: [],
|
||||
imageUrls: [],
|
||||
};
|
||||
|
||||
const screen = getScreenInfo();
|
||||
function Node(tag) {
|
||||
this.node = 'element';
|
||||
this.tag = tag;
|
||||
|
||||
this.$screen = screen;
|
||||
}
|
||||
|
||||
HTMLParser(html, {
|
||||
start(tag, attrs, unary) {
|
||||
// node for this element
|
||||
const node = new Node(tag);
|
||||
|
||||
if (bufArray.length !== 0) {
|
||||
const parent = bufArray[0];
|
||||
if (parent.nodes === undefined) {
|
||||
parent.nodes = [];
|
||||
}
|
||||
}
|
||||
|
||||
if (block[tag]) {
|
||||
node.tagType = 'block';
|
||||
} else if (inline[tag]) {
|
||||
node.tagType = 'inline';
|
||||
} else if (closeSelf[tag]) {
|
||||
node.tagType = 'closeSelf';
|
||||
}
|
||||
|
||||
node.attr = attrs.reduce((pre, attr) => {
|
||||
const { name } = attr;
|
||||
let { value } = attr;
|
||||
if (name === 'class') {
|
||||
node.classStr = value;
|
||||
}
|
||||
// has multi attibutes
|
||||
// make it array of attribute
|
||||
if (name === 'style') {
|
||||
node.styleStr = value;
|
||||
}
|
||||
if (value.match(/ /)) {
|
||||
value = value.split(' ');
|
||||
}
|
||||
|
||||
// if attr already exists
|
||||
// merge it
|
||||
if (pre[name]) {
|
||||
if (Array.isArray(pre[name])) {
|
||||
// already array, push to last
|
||||
pre[name].push(value);
|
||||
} else {
|
||||
// single value, make it array
|
||||
pre[name] = [pre[name], value];
|
||||
}
|
||||
} else {
|
||||
// not exist, put it
|
||||
pre[name] = value;
|
||||
}
|
||||
|
||||
return pre;
|
||||
}, {});
|
||||
|
||||
// 优化样式相关属性
|
||||
if (node.classStr) {
|
||||
node.classStr += ` ${node.tag}`;
|
||||
} else {
|
||||
node.classStr = node.tag;
|
||||
}
|
||||
if (node.tagType === 'inline') {
|
||||
node.classStr += ' inline';
|
||||
}
|
||||
|
||||
// 对img添加额外数据
|
||||
if (node.tag === 'img') {
|
||||
let imgUrl = node.attr.src;
|
||||
imgUrl = wxDiscode.urlToHttpUrl(imgUrl, imageProp.domain);
|
||||
Object.assign(node.attr, imageProp, {
|
||||
src: imgUrl || '',
|
||||
});
|
||||
if (imgUrl) {
|
||||
results.imageUrls.push(imgUrl);
|
||||
}
|
||||
}
|
||||
|
||||
// 处理a标签属性
|
||||
if (node.tag === 'a') {
|
||||
node.attr.href = node.attr.href || '';
|
||||
}
|
||||
|
||||
// 处理font标签样式属性
|
||||
if (node.tag === 'font') {
|
||||
const fontSize = [
|
||||
'x-small',
|
||||
'small',
|
||||
'medium',
|
||||
'large',
|
||||
'x-large',
|
||||
'xx-large',
|
||||
'-webkit-xxx-large',
|
||||
];
|
||||
const styleAttrs = {
|
||||
color: 'color',
|
||||
face: 'font-family',
|
||||
size: 'font-size',
|
||||
};
|
||||
if (!node.styleStr) node.styleStr = '';
|
||||
Object.keys(styleAttrs).forEach((key) => {
|
||||
if (node.attr[key]) {
|
||||
const value = key === 'size' ? fontSize[node.attr[key] - 1] : node.attr[key];
|
||||
node.styleStr += `${styleAttrs[key]}: ${value};`;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 临时记录source资源
|
||||
if (node.tag === 'source') {
|
||||
results.source = node.attr.src;
|
||||
}
|
||||
|
||||
if (customHandler.start) {
|
||||
customHandler.start(node, results);
|
||||
}
|
||||
|
||||
if (unary) {
|
||||
// if this tag doesn't have end tag
|
||||
// like <img src="hoge.png"/>
|
||||
// add to parents
|
||||
const parent = bufArray[0] || results;
|
||||
if (parent.nodes === undefined) {
|
||||
parent.nodes = [];
|
||||
}
|
||||
parent.nodes.push(node);
|
||||
} else {
|
||||
bufArray.unshift(node);
|
||||
}
|
||||
},
|
||||
end(tag) {
|
||||
// merge into parent tag
|
||||
const node = bufArray.shift();
|
||||
if (node.tag !== tag) {
|
||||
console.error('invalid state: mismatch end tag');
|
||||
}
|
||||
|
||||
// 当有缓存source资源时于于video补上src资源
|
||||
if (node.tag === 'video' && results.source) {
|
||||
node.attr.src = results.source;
|
||||
delete results.source;
|
||||
}
|
||||
|
||||
if (customHandler.end) {
|
||||
customHandler.end(node, results);
|
||||
}
|
||||
|
||||
if (bufArray.length === 0) {
|
||||
results.nodes.push(node);
|
||||
} else {
|
||||
const parent = bufArray[0];
|
||||
if (!parent.nodes) {
|
||||
parent.nodes = [];
|
||||
}
|
||||
parent.nodes.push(node);
|
||||
}
|
||||
},
|
||||
chars(text) {
|
||||
if (!text.trim()) return;
|
||||
|
||||
const node = {
|
||||
node: 'text',
|
||||
text,
|
||||
};
|
||||
|
||||
if (customHandler.chars) {
|
||||
customHandler.chars(node, results);
|
||||
}
|
||||
|
||||
if (bufArray.length === 0) {
|
||||
results.nodes.push(node);
|
||||
} else {
|
||||
const parent = bufArray[0];
|
||||
if (parent.nodes === undefined) {
|
||||
parent.nodes = [];
|
||||
}
|
||||
parent.nodes.push(node);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
export default html2json;
|
||||
156
components/u-parse/libs/htmlparser.js
Normal file
@@ -0,0 +1,156 @@
|
||||
/**
|
||||
*
|
||||
* htmlParser改造自: https://github.com/blowsie/Pure-JavaScript-HTML5-Parser
|
||||
*
|
||||
* author: Di (微信小程序开发工程师)
|
||||
* organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
|
||||
* 垂直微信小程序开发交流社区
|
||||
*
|
||||
* github地址: https://github.com/icindy/wxParse
|
||||
*
|
||||
* for: 微信小程序富文本解析
|
||||
* detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
|
||||
*/
|
||||
// Regular Expressions for parsing tags and attributes
|
||||
|
||||
const startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z0-9_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/;
|
||||
const endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/;
|
||||
const attr = /([a-zA-Z0-9_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g;
|
||||
|
||||
function makeMap(str) {
|
||||
const obj = {};
|
||||
const items = str.split(',');
|
||||
for (let i = 0; i < items.length; i += 1) obj[items[i]] = true;
|
||||
return obj;
|
||||
}
|
||||
|
||||
// Empty Elements - HTML 5
|
||||
const empty = makeMap('area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr');
|
||||
|
||||
// Block Elements - HTML 5
|
||||
const block = makeMap('address,code,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video');
|
||||
|
||||
// Inline Elements - HTML 5
|
||||
const inline = makeMap('a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var');
|
||||
|
||||
// Elements that you can, intentionally, leave open
|
||||
// (and which close themselves)
|
||||
const closeSelf = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr');
|
||||
|
||||
// Attributes that have their values filled in disabled="disabled"
|
||||
const fillAttrs = makeMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected');
|
||||
|
||||
function HTMLParser(html, handler) {
|
||||
let index;
|
||||
let chars;
|
||||
let match;
|
||||
let last = html;
|
||||
const stack = [];
|
||||
|
||||
stack.last = () => stack[stack.length - 1];
|
||||
|
||||
function parseEndTag(tag, tagName) {
|
||||
// If no tag name is provided, clean shop
|
||||
let pos;
|
||||
if (!tagName) {
|
||||
pos = 0;
|
||||
} else {
|
||||
// Find the closest opened tag of the same type
|
||||
tagName = tagName.toLowerCase();
|
||||
for (pos = stack.length - 1; pos >= 0; pos -= 1) {
|
||||
if (stack[pos] === tagName) break;
|
||||
}
|
||||
}
|
||||
if (pos >= 0) {
|
||||
// Close all the open elements, up the stack
|
||||
for (let i = stack.length - 1; i >= pos; i -= 1) {
|
||||
if (handler.end) handler.end(stack[i]);
|
||||
}
|
||||
|
||||
// Remove the open elements from the stack
|
||||
stack.length = pos;
|
||||
}
|
||||
}
|
||||
|
||||
function parseStartTag(tag, tagName, rest, unary) {
|
||||
tagName = tagName.toLowerCase();
|
||||
|
||||
if (block[tagName]) {
|
||||
while (stack.last() && inline[stack.last()]) {
|
||||
parseEndTag('', stack.last());
|
||||
}
|
||||
}
|
||||
|
||||
if (closeSelf[tagName] && stack.last() === tagName) {
|
||||
parseEndTag('', tagName);
|
||||
}
|
||||
|
||||
unary = empty[tagName] || !!unary;
|
||||
|
||||
if (!unary) stack.push(tagName);
|
||||
|
||||
if (handler.start) {
|
||||
const attrs = [];
|
||||
|
||||
rest.replace(attr, function genAttr(matches, name) {
|
||||
const value = arguments[2] || arguments[3] || arguments[4] || (fillAttrs[name] ? name : '');
|
||||
|
||||
attrs.push({
|
||||
name,
|
||||
value,
|
||||
escaped: value.replace(/(^|[^\\])"/g, '$1\\"'), // "
|
||||
});
|
||||
});
|
||||
|
||||
if (handler.start) {
|
||||
handler.start(tagName, attrs, unary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (html) {
|
||||
chars = true;
|
||||
|
||||
if (html.indexOf('</') === 0) {
|
||||
match = html.match(endTag);
|
||||
|
||||
if (match) {
|
||||
html = html.substring(match[0].length);
|
||||
match[0].replace(endTag, parseEndTag);
|
||||
chars = false;
|
||||
}
|
||||
|
||||
// start tag
|
||||
} else if (html.indexOf('<') === 0) {
|
||||
match = html.match(startTag);
|
||||
|
||||
if (match) {
|
||||
html = html.substring(match[0].length);
|
||||
match[0].replace(startTag, parseStartTag);
|
||||
chars = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (chars) {
|
||||
index = html.indexOf('<');
|
||||
let text = '';
|
||||
while (index === 0) {
|
||||
text += '<';
|
||||
html = html.substring(1);
|
||||
index = html.indexOf('<');
|
||||
}
|
||||
text += index < 0 ? html : html.substring(0, index);
|
||||
html = index < 0 ? '' : html.substring(index);
|
||||
|
||||
if (handler.chars) handler.chars(text);
|
||||
}
|
||||
|
||||
if (html === last) throw new Error(`Parse Error: ${html}`);
|
||||
last = html;
|
||||
}
|
||||
|
||||
// Clean up any remaining tags
|
||||
parseEndTag();
|
||||
}
|
||||
|
||||
export default HTMLParser;
|
||||
195
components/u-parse/libs/wxDiscode.js
Normal file
@@ -0,0 +1,195 @@
|
||||
// HTML 支持的数学符号
|
||||
function strNumDiscode(str) {
|
||||
str = str.replace(/∀/g, '∀');
|
||||
str = str.replace(/∂/g, '∂');
|
||||
str = str.replace(/∃/g, '∃');
|
||||
str = str.replace(/∅/g, '∅');
|
||||
str = str.replace(/∇/g, '∇');
|
||||
str = str.replace(/∈/g, '∈');
|
||||
str = str.replace(/∉/g, '∉');
|
||||
str = str.replace(/∋/g, '∋');
|
||||
str = str.replace(/∏/g, '∏');
|
||||
str = str.replace(/∑/g, '∑');
|
||||
str = str.replace(/−/g, '−');
|
||||
str = str.replace(/∗/g, '∗');
|
||||
str = str.replace(/√/g, '√');
|
||||
str = str.replace(/∝/g, '∝');
|
||||
str = str.replace(/∞/g, '∞');
|
||||
str = str.replace(/∠/g, '∠');
|
||||
str = str.replace(/∧/g, '∧');
|
||||
str = str.replace(/∨/g, '∨');
|
||||
str = str.replace(/∩/g, '∩');
|
||||
str = str.replace(/∪/g, '∪');
|
||||
str = str.replace(/∫/g, '∫');
|
||||
str = str.replace(/∴/g, '∴');
|
||||
str = str.replace(/∼/g, '∼');
|
||||
str = str.replace(/≅/g, '≅');
|
||||
str = str.replace(/≈/g, '≈');
|
||||
str = str.replace(/≠/g, '≠');
|
||||
str = str.replace(/≤/g, '≤');
|
||||
str = str.replace(/≥/g, '≥');
|
||||
str = str.replace(/⊂/g, '⊂');
|
||||
str = str.replace(/⊃/g, '⊃');
|
||||
str = str.replace(/⊄/g, '⊄');
|
||||
str = str.replace(/⊆/g, '⊆');
|
||||
str = str.replace(/⊇/g, '⊇');
|
||||
str = str.replace(/⊕/g, '⊕');
|
||||
str = str.replace(/⊗/g, '⊗');
|
||||
str = str.replace(/⊥/g, '⊥');
|
||||
str = str.replace(/⋅/g, '⋅');
|
||||
return str;
|
||||
}
|
||||
|
||||
// HTML 支持的希腊字母
|
||||
function strGreeceDiscode(str) {
|
||||
str = str.replace(/Α/g, 'Α');
|
||||
str = str.replace(/Β/g, 'Β');
|
||||
str = str.replace(/Γ/g, 'Γ');
|
||||
str = str.replace(/Δ/g, 'Δ');
|
||||
str = str.replace(/Ε/g, 'Ε');
|
||||
str = str.replace(/Ζ/g, 'Ζ');
|
||||
str = str.replace(/Η/g, 'Η');
|
||||
str = str.replace(/Θ/g, 'Θ');
|
||||
str = str.replace(/Ι/g, 'Ι');
|
||||
str = str.replace(/Κ/g, 'Κ');
|
||||
str = str.replace(/Λ/g, 'Λ');
|
||||
str = str.replace(/Μ/g, 'Μ');
|
||||
str = str.replace(/Ν/g, 'Ν');
|
||||
str = str.replace(/Ξ/g, 'Ν');
|
||||
str = str.replace(/Ο/g, 'Ο');
|
||||
str = str.replace(/Π/g, 'Π');
|
||||
str = str.replace(/Ρ/g, 'Ρ');
|
||||
str = str.replace(/Σ/g, 'Σ');
|
||||
str = str.replace(/Τ/g, 'Τ');
|
||||
str = str.replace(/Υ/g, 'Υ');
|
||||
str = str.replace(/Φ/g, 'Φ');
|
||||
str = str.replace(/Χ/g, 'Χ');
|
||||
str = str.replace(/Ψ/g, 'Ψ');
|
||||
str = str.replace(/Ω/g, 'Ω');
|
||||
|
||||
str = str.replace(/α/g, 'α');
|
||||
str = str.replace(/β/g, 'β');
|
||||
str = str.replace(/γ/g, 'γ');
|
||||
str = str.replace(/δ/g, 'δ');
|
||||
str = str.replace(/ε/g, 'ε');
|
||||
str = str.replace(/ζ/g, 'ζ');
|
||||
str = str.replace(/η/g, 'η');
|
||||
str = str.replace(/θ/g, 'θ');
|
||||
str = str.replace(/ι/g, 'ι');
|
||||
str = str.replace(/κ/g, 'κ');
|
||||
str = str.replace(/λ/g, 'λ');
|
||||
str = str.replace(/μ/g, 'μ');
|
||||
str = str.replace(/ν/g, 'ν');
|
||||
str = str.replace(/ξ/g, 'ξ');
|
||||
str = str.replace(/ο/g, 'ο');
|
||||
str = str.replace(/π/g, 'π');
|
||||
str = str.replace(/ρ/g, 'ρ');
|
||||
str = str.replace(/ς/g, 'ς');
|
||||
str = str.replace(/σ/g, 'σ');
|
||||
str = str.replace(/τ/g, 'τ');
|
||||
str = str.replace(/υ/g, 'υ');
|
||||
str = str.replace(/φ/g, 'φ');
|
||||
str = str.replace(/χ/g, 'χ');
|
||||
str = str.replace(/ψ/g, 'ψ');
|
||||
str = str.replace(/ω/g, 'ω');
|
||||
str = str.replace(/ϑ/g, 'ϑ');
|
||||
str = str.replace(/ϒ/g, 'ϒ');
|
||||
str = str.replace(/ϖ/g, 'ϖ');
|
||||
str = str.replace(/·/g, '·');
|
||||
return str;
|
||||
}
|
||||
|
||||
function strcharacterDiscode(str) {
|
||||
// 加入常用解析
|
||||
str = str.replace(/ /g, ' ');
|
||||
str = str.replace(/ /g, ' ');
|
||||
str = str.replace(/ /g, ' ');
|
||||
str = str.replace(/"/g, "'");
|
||||
str = str.replace(/&/g, '&');
|
||||
str = str.replace(/</g, '<');
|
||||
str = str.replace(/>/g, '>');
|
||||
str = str.replace(/•/g, '•');
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
// HTML 支持的其他实体
|
||||
function strOtherDiscode(str) {
|
||||
str = str.replace(/Œ/g, 'Œ');
|
||||
str = str.replace(/œ/g, 'œ');
|
||||
str = str.replace(/Š/g, 'Š');
|
||||
str = str.replace(/š/g, 'š');
|
||||
str = str.replace(/Ÿ/g, 'Ÿ');
|
||||
str = str.replace(/ƒ/g, 'ƒ');
|
||||
str = str.replace(/ˆ/g, 'ˆ');
|
||||
str = str.replace(/˜/g, '˜');
|
||||
str = str.replace(/ /g, '');
|
||||
str = str.replace(/ /g, '');
|
||||
str = str.replace(/ /g, '');
|
||||
str = str.replace(/‌/g, '');
|
||||
str = str.replace(/‍/g, '');
|
||||
str = str.replace(/‎/g, '');
|
||||
str = str.replace(/‏/g, '');
|
||||
str = str.replace(/–/g, '–');
|
||||
str = str.replace(/—/g, '—');
|
||||
str = str.replace(/‘/g, '‘');
|
||||
str = str.replace(/’/g, '’');
|
||||
str = str.replace(/‚/g, '‚');
|
||||
str = str.replace(/“/g, '“');
|
||||
str = str.replace(/”/g, '”');
|
||||
str = str.replace(/„/g, '„');
|
||||
str = str.replace(/†/g, '†');
|
||||
str = str.replace(/‡/g, '‡');
|
||||
str = str.replace(/•/g, '•');
|
||||
str = str.replace(/…/g, '…');
|
||||
str = str.replace(/‰/g, '‰');
|
||||
str = str.replace(/′/g, '′');
|
||||
str = str.replace(/″/g, '″');
|
||||
str = str.replace(/‹/g, '‹');
|
||||
str = str.replace(/›/g, '›');
|
||||
str = str.replace(/‾/g, '‾');
|
||||
str = str.replace(/€/g, '€');
|
||||
str = str.replace(/™/g, '™');
|
||||
|
||||
str = str.replace(/←/g, '←');
|
||||
str = str.replace(/↑/g, '↑');
|
||||
str = str.replace(/→/g, '→');
|
||||
str = str.replace(/↓/g, '↓');
|
||||
str = str.replace(/↔/g, '↔');
|
||||
str = str.replace(/↵/g, '↵');
|
||||
str = str.replace(/⌈/g, '⌈');
|
||||
str = str.replace(/⌉/g, '⌉');
|
||||
|
||||
str = str.replace(/⌊/g, '⌊');
|
||||
str = str.replace(/⌋/g, '⌋');
|
||||
str = str.replace(/◊/g, '◊');
|
||||
str = str.replace(/♠/g, '♠');
|
||||
str = str.replace(/♣/g, '♣');
|
||||
str = str.replace(/♥/g, '♥');
|
||||
|
||||
str = str.replace(/♦/g, '♦');
|
||||
str = str.replace(/'/g, "'");
|
||||
return str;
|
||||
}
|
||||
|
||||
function strDiscode(str) {
|
||||
str = strNumDiscode(str);
|
||||
str = strGreeceDiscode(str);
|
||||
str = strcharacterDiscode(str);
|
||||
str = strOtherDiscode(str);
|
||||
return str;
|
||||
}
|
||||
|
||||
function urlToHttpUrl(url, domain) {
|
||||
if (/^\/\//.test(url)) {
|
||||
return `https:${url}`;
|
||||
} else if (/^\//.test(url)) {
|
||||
return `https://${domain}${url}`;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
export default {
|
||||
strDiscode,
|
||||
urlToHttpUrl,
|
||||
};
|
||||
102
components/u-parse/readme.md
Normal file
@@ -0,0 +1,102 @@
|
||||
## uParse 适用于 uni-app/mpvue 的富文本解析组件
|
||||
|
||||
> 支持 Html、Markdown 解析,Fork自: [mpvue-wxParse](https://github.com/F-loat/mpvue-wxParse)
|
||||
|
||||
|
||||
## 属性
|
||||
|
||||
| 名称 | 类型 | 默认值 | 描述 |
|
||||
| -----------------|--------------- | ------------- | ---------------- |
|
||||
| loading | Boolean | false | 数据加载状态 |
|
||||
| className | String | — | 自定义 class 名称 |
|
||||
| content | String | — | 渲染内容 |
|
||||
| noData | String | 数据不能为空 | 空数据时的渲染展示 |
|
||||
| startHandler | Function | 见源码 | 自定义 parser 函数 |
|
||||
| endHandler | Function | null | 自定义 parser 函数 |
|
||||
| charsHandler | Function | null | 自定义 parser 函数 |
|
||||
| imageProp | Object | 见下文 | 图片相关参数 |
|
||||
|
||||
### 自定义 parser 函数具体介绍
|
||||
|
||||
* 传入的参数为当前节点 `node` 对象及解析结果 `results` 对象,例如 `startHandler(node, results)`
|
||||
* 无需返回值,通过对传入的参数直接操作来完成需要的改动
|
||||
* 自定义函数会在原解析函数处理之后执行
|
||||
|
||||
### imageProp 对象具体属性
|
||||
|
||||
| 名称 | 类型 | 默认值 | 描述 |
|
||||
| -----------------|--------------- | ------------- | ------------------ |
|
||||
| mode | String | 'aspectFit' | 图片裁剪、缩放的模式 |
|
||||
| padding | Number | 0 | 图片内边距 |
|
||||
| lazyLoad | Boolean | false | 图片懒加载 |
|
||||
| domain | String | '' | 图片服务域名 |
|
||||
|
||||
## 事件
|
||||
|
||||
| 名称 | 参数 | 描述 |
|
||||
| -----------------|----------------- | ---------------- |
|
||||
| preview | 图片地址,原始事件 | 预览图片时触发 |
|
||||
| navigate | 链接地址,原始事件 | 点击链接时触发 |
|
||||
|
||||
## 基本使用方法
|
||||
|
||||
|
||||
``` vue
|
||||
<template>
|
||||
<div>
|
||||
<u-parse :content="article" @preview="preview" @navigate="navigate" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import uParse from '@/components/u-parse/u-parse.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
uParse
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
article: '<div>我是HTML代码</div>'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
preview(src, e) {
|
||||
// do something
|
||||
},
|
||||
navigate(href, e) {
|
||||
// do something
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@import url("@/components/u-parse/u-parse.css");
|
||||
</style>
|
||||
```
|
||||
|
||||
|
||||
## 渲染 Markdown
|
||||
|
||||
> 先将 markdown 转换为 html 即可
|
||||
|
||||
```
|
||||
npm install marked
|
||||
```
|
||||
|
||||
``` js
|
||||
import marked from 'marked'
|
||||
import uParse from '@/components/u-parse/u-parse.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
uParse
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
article: marked(`#hello, markdown!`)
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
232
components/u-parse/u-parse.css
Normal file
@@ -0,0 +1,232 @@
|
||||
/**
|
||||
* author: Di (微信小程序开发工程师)
|
||||
* organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
|
||||
* 垂直微信小程序开发交流社区
|
||||
*
|
||||
* github地址: https://github.com/icindy/wxParse
|
||||
*
|
||||
* for: 微信小程序富文本解析
|
||||
* detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
|
||||
*/
|
||||
|
||||
.wxParse {
|
||||
width: 100%;
|
||||
font-family: Helvetica, sans-serif;
|
||||
font-size: 30upx;
|
||||
color: #666;
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
.wxParse view {
|
||||
word-break: hyphenate;
|
||||
}
|
||||
|
||||
.wxParse .inline {
|
||||
display: inline;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.wxParse .div {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.wxParse .h1 .text {
|
||||
font-size: 2em;
|
||||
margin: 0.67em 0;
|
||||
}
|
||||
.wxParse .h2 .text {
|
||||
font-size: 1.5em;
|
||||
margin: 0.83em 0;
|
||||
}
|
||||
.wxParse .h3 .text {
|
||||
font-size: 1.17em;
|
||||
margin: 1em 0;
|
||||
}
|
||||
.wxParse .h4 .text {
|
||||
margin: 1.33em 0;
|
||||
}
|
||||
.wxParse .h5 .text {
|
||||
font-size: 0.83em;
|
||||
margin: 1.67em 0;
|
||||
}
|
||||
.wxParse .h6 .text {
|
||||
font-size: 0.67em;
|
||||
margin: 2.33em 0;
|
||||
}
|
||||
|
||||
.wxParse .h1 .text,
|
||||
.wxParse .h2 .text,
|
||||
.wxParse .h3 .text,
|
||||
.wxParse .h4 .text,
|
||||
.wxParse .h5 .text,
|
||||
.wxParse .h6 .text,
|
||||
.wxParse .b,
|
||||
.wxParse .strong {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
|
||||
.wxParse .p {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
.wxParse .i,
|
||||
.wxParse .cite,
|
||||
.wxParse .em,
|
||||
.wxParse .var,
|
||||
.wxParse .address {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.wxParse .pre,
|
||||
.wxParse .tt,
|
||||
.wxParse .code,
|
||||
.wxParse .kbd,
|
||||
.wxParse .samp {
|
||||
font-family: monospace;
|
||||
}
|
||||
.wxParse .pre {
|
||||
overflow: auto;
|
||||
background: #f5f5f5;
|
||||
padding: 16upx;
|
||||
white-space: pre;
|
||||
margin: 1em 0upx;
|
||||
}
|
||||
.wxParse .code {
|
||||
display: inline;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.wxParse .big {
|
||||
font-size: 1.17em;
|
||||
}
|
||||
|
||||
.wxParse .small,
|
||||
.wxParse .sub,
|
||||
.wxParse .sup {
|
||||
font-size: 0.83em;
|
||||
}
|
||||
|
||||
.wxParse .sub {
|
||||
vertical-align: sub;
|
||||
}
|
||||
.wxParse .sup {
|
||||
vertical-align: super;
|
||||
}
|
||||
|
||||
.wxParse .s,
|
||||
.wxParse .strike,
|
||||
.wxParse .del {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.wxParse .strong,
|
||||
.wxParse .s {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.wxParse .a {
|
||||
color: deepskyblue;
|
||||
}
|
||||
|
||||
.wxParse .video {
|
||||
text-align: center;
|
||||
margin: 22upx 0;
|
||||
}
|
||||
|
||||
.wxParse .video-video {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.wxParse .img {
|
||||
display: inline-block;
|
||||
width: 0;
|
||||
height: 0;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.wxParse .blockquote {
|
||||
margin: 10upx 0;
|
||||
padding: 22upx 0 22upx 22upx;
|
||||
font-family: Courier, Calibri, "宋体";
|
||||
background: #f5f5f5;
|
||||
border-left: 6upx solid #dbdbdb;
|
||||
}
|
||||
.wxParse .blockquote .p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.wxParse .ul, .wxParse .ol {
|
||||
display: block;
|
||||
margin: 1em 0;
|
||||
padding-left: 33upx;
|
||||
}
|
||||
.wxParse .ol {
|
||||
list-style-type: disc;
|
||||
}
|
||||
.wxParse .ol {
|
||||
list-style-type: decimal;
|
||||
}
|
||||
.wxParse .ol>weixin-parse-template,.wxParse .ul>weixin-parse-template {
|
||||
display: list-item;
|
||||
align-items: baseline;
|
||||
text-align: match-parent;
|
||||
}
|
||||
|
||||
.wxParse .ol>.li,.wxParse .ul>.li {
|
||||
display: list-item;
|
||||
align-items: baseline;
|
||||
text-align: match-parent;
|
||||
}
|
||||
.wxParse .ul .ul, .wxParse .ol .ul {
|
||||
list-style-type: circle;
|
||||
}
|
||||
.wxParse .ol .ol .ul, .wxParse .ol .ul .ul, .wxParse .ul .ol .ul, .wxParse .ul .ul .ul {
|
||||
list-style-type: square;
|
||||
}
|
||||
|
||||
.wxParse .u {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.wxParse .hide {
|
||||
display: none;
|
||||
}
|
||||
.wxParse .del {
|
||||
display: inline;
|
||||
}
|
||||
.wxParse .figure {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.wxParse .table {
|
||||
width: 100%;
|
||||
}
|
||||
.wxParse .thead, .wxParse .tfoot, .wxParse .tr {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
.wxParse .tr {
|
||||
width:100%;
|
||||
display: flex;
|
||||
border-right: 2upx solid #e0e0e0;
|
||||
border-bottom: 2upx solid #e0e0e0;
|
||||
}
|
||||
.wxParse .th,
|
||||
.wxParse .td {
|
||||
display: flex;
|
||||
width: 1276upx;
|
||||
overflow: auto;
|
||||
flex: 1;
|
||||
padding: 11upx;
|
||||
border-left: 2upx solid #e0e0e0;
|
||||
}
|
||||
.wxParse .td:last {
|
||||
border-top: 2upx solid #e0e0e0;
|
||||
}
|
||||
.wxParse .th {
|
||||
background: #f0f0f0;
|
||||
border-top: 2upx solid #e0e0e0;
|
||||
}
|
||||
118
components/u-parse/u-parse.vue
Normal file
@@ -0,0 +1,118 @@
|
||||
<!--**
|
||||
* forked from:https://github.com/F-loat/mpvue-wxParse
|
||||
*
|
||||
* github地址: https://github.com/dcloudio/uParse
|
||||
*
|
||||
* for: uni-app框架下 富文本解析
|
||||
*/-->
|
||||
|
||||
<template>
|
||||
<!--基础元素-->
|
||||
<div class="wxParse" :class="className" v-if="!loading">
|
||||
<block v-for="(node,index) of nodes" :key="index">
|
||||
<wxParseTemplate :node="node" />
|
||||
</block>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import HtmlToJson from './libs/html2json';
|
||||
import wxParseTemplate from './components/wxParseTemplate0';
|
||||
|
||||
export default {
|
||||
name: 'wxParse',
|
||||
props: {
|
||||
loading: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
className: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
content: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
noData: {
|
||||
type: String,
|
||||
default: '<div style="color: red;">数据不能为空</div>',
|
||||
},
|
||||
startHandler: {
|
||||
type: Function,
|
||||
default() {
|
||||
return (node) => {
|
||||
node.attr.class = null;
|
||||
node.attr.style = null;
|
||||
};
|
||||
},
|
||||
},
|
||||
endHandler: {
|
||||
type: Function,
|
||||
default: null,
|
||||
},
|
||||
charsHandler: {
|
||||
type: Function,
|
||||
default: null,
|
||||
},
|
||||
imageProp: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {
|
||||
mode: 'aspectFit',
|
||||
padding: 0,
|
||||
lazyLoad: false,
|
||||
domain: '',
|
||||
};
|
||||
},
|
||||
},
|
||||
},
|
||||
components: {
|
||||
wxParseTemplate,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
imageUrls: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
nodes() {
|
||||
const {
|
||||
content,
|
||||
noData,
|
||||
imageProp,
|
||||
startHandler,
|
||||
endHandler,
|
||||
charsHandler,
|
||||
} = this;
|
||||
const parseData = content || noData;
|
||||
const customHandler = {
|
||||
start: startHandler,
|
||||
end: endHandler,
|
||||
chars: charsHandler,
|
||||
};
|
||||
const results = HtmlToJson(parseData, customHandler, imageProp, this);
|
||||
this.imageUrls = results.imageUrls;
|
||||
console.log(results)
|
||||
return results.nodes;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
navigate(href, $event) {
|
||||
this.$emit('navigate', href, $event);
|
||||
},
|
||||
preview(src, $event) {
|
||||
if (!this.imageUrls.length) return;
|
||||
wx.previewImage({
|
||||
current: src,
|
||||
urls: this.imageUrls,
|
||||
});
|
||||
this.$emit('preview', src, $event);
|
||||
},
|
||||
removeImageUrl(src) {
|
||||
const { imageUrls } = this;
|
||||
imageUrls.splice(imageUrls.indexOf(src), 1);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
121
components/uni-searchbar.vue
Normal file
@@ -0,0 +1,121 @@
|
||||
<template>
|
||||
<!-- 顶部导航栏 -->
|
||||
<view class="search-bar-container">
|
||||
<view class="search-box" :style="{marginTop:searchBarTop + 'px',height:searchBarHeight + 'px'}">
|
||||
<view class="top-left">
|
||||
<view class="back-button" hover-class="back-button-active" @click="goBack">
|
||||
<u-icon name="arrow-left" color="#fff;" />
|
||||
</view>
|
||||
<view class="search-input">
|
||||
<u-input v-if="!readOnly" v-model="queryParamF" :focus="true" placeholder="搜索优质产品"
|
||||
prefixIcon="search" :border="false" style="background-color: #fff;border: none;"
|
||||
confirm-type="go" @confirm="goSearch(queryParamF)" />
|
||||
<view v-else style="width: 360rpx;padding: 10rpx 20rpx;display: flex;align-items: center;"
|
||||
@click="goSearch">
|
||||
<u-icon name="search" color="#969696" size="22"></u-icon>
|
||||
<text
|
||||
style="margin-left:10rpx;font-size: 30rpx;font-family: PingFangSC-Regular, PingFang SC;font-weight: 400;color: #969696;line-height: 37rpx;">搜索优质商品</text>
|
||||
</view>
|
||||
<view class="search-btn" @click="goSearch">搜索</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "searchBar",
|
||||
props: {
|
||||
searchBarTop: {
|
||||
//搜索栏的外边框高度,单位px
|
||||
type: Number,
|
||||
default: 30
|
||||
},
|
||||
searchBarHeight: {
|
||||
//搜索栏的高度,单位px
|
||||
type: Number,
|
||||
default: 30
|
||||
},
|
||||
queryParam: {
|
||||
type: String,
|
||||
default: null
|
||||
},
|
||||
readOnly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
queryParamF: ''
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
queryParam: {
|
||||
handler(val) {
|
||||
this.queryParamF = this.queryParam || ''
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
goSearch(value) {
|
||||
if (!this.queryParamF && value) {
|
||||
this.queryParamF = value
|
||||
}
|
||||
if (this.readOnly) {
|
||||
this.$emit('navigate')
|
||||
return
|
||||
}
|
||||
this.$emit('search', this.queryParamF)
|
||||
},
|
||||
goBack() {
|
||||
this.$emit('back')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.search-bar-container {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
// z-index: 999;
|
||||
width: 100%;
|
||||
background-color: #12CA64;
|
||||
|
||||
.search-box {
|
||||
margin: 10rpx 10rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.top-left {
|
||||
width: calc(100% - 200rpx);
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
|
||||
.search-input {
|
||||
display: flex;
|
||||
border: 2rpx solid #fff;
|
||||
background-color: #fff;
|
||||
border-radius: 50rpx;
|
||||
height: 100%;
|
||||
margin-left: 10rpx;
|
||||
|
||||
.search-btn {
|
||||
font-size: 32rpx;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #3E3E3E;
|
||||
line-height: 64rpx;
|
||||
margin-right: 18rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
9
main.js
@@ -1,14 +1,19 @@
|
||||
import App from './App'
|
||||
// 引入uView-ui组件库(注意这两行要放在 import Vue 之后)
|
||||
|
||||
//引入uView-ui组件库(注意这两行要放在 import Vue 之后)
|
||||
import uView from 'uview-ui'
|
||||
import { apiService, toast } from "./service/request.js"
|
||||
Vue.use(uView)
|
||||
|
||||
Vue.prototype.$apiServe = apiService
|
||||
Vue.prototype.$toast= toast
|
||||
|
||||
// #ifndef VUE3
|
||||
import Vue from 'vue'
|
||||
Vue.config.productionTip = false
|
||||
App.mpType = 'app'
|
||||
const app = new Vue({
|
||||
...App
|
||||
...App
|
||||
})
|
||||
app.$mount()
|
||||
// #endif
|
||||
|
||||
152
manifest.json
@@ -1,73 +1,83 @@
|
||||
{
|
||||
"name" : "shitong-app",
|
||||
"appid" : "",
|
||||
"description" : "",
|
||||
"versionName" : "1.0.0",
|
||||
"versionCode" : "100",
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
"usingComponents" : true,
|
||||
"nvueStyleCompiler" : "uni-app",
|
||||
"compilerVersion" : 3,
|
||||
"splashscreen" : {
|
||||
"alwaysShowBeforeRender" : true,
|
||||
"waiting" : true,
|
||||
"autoclose" : true,
|
||||
"delay" : 0
|
||||
},
|
||||
/* 模块配置 */
|
||||
"modules" : {},
|
||||
/* 应用发布信息 */
|
||||
"distribute" : {
|
||||
/* android打包配置 */
|
||||
"android" : {
|
||||
"permissions" : [
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||
]
|
||||
},
|
||||
/* ios打包配置 */
|
||||
"ios" : {},
|
||||
/* SDK配置 */
|
||||
"sdkConfigs" : {}
|
||||
}
|
||||
},
|
||||
/* 快应用特有相关 */
|
||||
"quickapp" : {},
|
||||
/* 小程序特有相关 */
|
||||
"mp-weixin" : {
|
||||
"appid" : "wxcd04cc6e99e18009",
|
||||
"setting" : {
|
||||
"urlCheck" : false,
|
||||
"es6" : false
|
||||
},
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-alipay" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-baidu" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-toutiao" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"uniStatistics" : {
|
||||
"enable" : false
|
||||
},
|
||||
"vueVersion" : "2"
|
||||
"name": "shitong-app",
|
||||
"appid": "__UNI__807D381",
|
||||
"description": "",
|
||||
"versionName": "1.0.0",
|
||||
"versionCode": "100",
|
||||
"transformPx": false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus": {
|
||||
"usingComponents": true,
|
||||
"nvueStyleCompiler": "uni-app",
|
||||
"compilerVersion": 3,
|
||||
"splashscreen": {
|
||||
"alwaysShowBeforeRender": true,
|
||||
"waiting": true,
|
||||
"autoclose": true,
|
||||
"delay": 0
|
||||
},
|
||||
/* 模块配置 */
|
||||
"modules": {
|
||||
"Share": {}
|
||||
},
|
||||
/* 应用发布信息 */
|
||||
"distribute": {
|
||||
/* android打包配置 */
|
||||
"android": {
|
||||
"permissions": [
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||
]
|
||||
},
|
||||
/* ios打包配置 */
|
||||
"ios": {},
|
||||
/* SDK配置 */
|
||||
"sdkConfigs": {
|
||||
"share": {
|
||||
"weixin": {
|
||||
"appid": "wx8da30ba464a770ba",
|
||||
"UniversalLinks": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
/* 快应用特有相关 */
|
||||
"quickapp": {},
|
||||
/* 小程序特有相关 */
|
||||
"mp-weixin": {
|
||||
"appid": "wx8da30ba464a770ba",
|
||||
"setting": {
|
||||
"urlCheck": false,
|
||||
"es6": false,
|
||||
"postcss": false
|
||||
},
|
||||
"usingComponents": true
|
||||
},
|
||||
"mp-alipay": {
|
||||
"usingComponents": true
|
||||
},
|
||||
"mp-baidu": {
|
||||
"usingComponents": true
|
||||
},
|
||||
"mp-toutiao": {
|
||||
"usingComponents": true
|
||||
},
|
||||
"uniStatistics": {
|
||||
"enable": false
|
||||
},
|
||||
"vueVersion": "2"
|
||||
}
|
||||
|
||||
24
package-lock.json
generated
@@ -1,27 +1,11 @@
|
||||
{
|
||||
"name": "shitong-app",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"uview-ui": "^2.0.35"
|
||||
}
|
||||
},
|
||||
"node_modules/uview-ui": {
|
||||
"version": "2.0.35",
|
||||
"resolved": "https://registry.npmmirror.com/uview-ui/-/uview-ui-2.0.35.tgz",
|
||||
"integrity": "sha512-OfMttN3XkHvQosXfd8bjz8ASTvypPoGzBWmQZBJ871bYMCA7t2bDFPlzjbxUj/5ykAjKnZ8zMUapSwSisVt99g==",
|
||||
"engines": {
|
||||
"HBuilderX": "^3.1.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"lockfileVersion": 1,
|
||||
"dependencies": {
|
||||
"uview-ui": {
|
||||
"version": "2.0.35",
|
||||
"resolved": "https://registry.npmmirror.com/uview-ui/-/uview-ui-2.0.35.tgz",
|
||||
"integrity": "sha512-OfMttN3XkHvQosXfd8bjz8ASTvypPoGzBWmQZBJ871bYMCA7t2bDFPlzjbxUj/5ykAjKnZ8zMUapSwSisVt99g=="
|
||||
"version": "2.0.36",
|
||||
"resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-2.0.36.tgz",
|
||||
"integrity": "sha512-ASSZT6M8w3GTO1eFPbsgEFV0U5UujK+8pTNr+MSUbRNcRMC1u63DDTLJVeArV91kWM0bfAexK3SK9pnTqF9TtA=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"uview-ui": "^2.0.35"
|
||||
"uview-ui": "^2.0.36"
|
||||
}
|
||||
}
|
||||
|
||||
65
packageMy/bindCompany/bindCompany.vue
Normal file
@@ -0,0 +1,65 @@
|
||||
<template>
|
||||
<view>
|
||||
<myForm ref="nameAndphone"></myForm>
|
||||
<view style="height: 168rpx;"></view>
|
||||
<u-button type="success" text="确定" color="#0EBB5B" @click="handleSureClick()"></u-button>
|
||||
<u-modal :show="showM" closeOnClickOverlay="false" confirmText="确定" @confirm="confirm">
|
||||
<rich-text :nodes="content"></rich-text>
|
||||
</u-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
name: '',
|
||||
phone: '',
|
||||
showM: false,
|
||||
content: `您的申请已提交<br>
|
||||
请静待人工审核`
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// handleSureClick() {
|
||||
// let name = this.$refs.nameAndphone.model.userInfo.name
|
||||
// let phone = this.$refs.nameAndphone.model.userInfo.phone
|
||||
// if (!/^1[3456789]\d{9}$/.test(phone)) {
|
||||
// this.$toast.warn('请输入正确的手机号')
|
||||
// return false
|
||||
// }
|
||||
// // this.$apiServe.bindComponyAndUpdate({
|
||||
// // uid: 1,
|
||||
// // type: 1,
|
||||
// // companyName: name,
|
||||
// // companyPhone: phone
|
||||
// // }).then(res => {
|
||||
// // console.log('绑定公司', res.data);
|
||||
// // if (res.data.code == 20003) {
|
||||
// // this.showM = true
|
||||
// // } else if (res.data.code == 20005) {
|
||||
// // this.$toast.warn('请完善数据')
|
||||
// // }
|
||||
// // }).finally(_ => {})
|
||||
// },
|
||||
// confirm() {
|
||||
// uni.reLaunch({
|
||||
// url: '/pages/my/my'
|
||||
// })
|
||||
// }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.u-button {
|
||||
width: 644rpx !important;
|
||||
height: 86rpx !important;
|
||||
background: #0EBB5B;
|
||||
border-radius: 20rpx !important;
|
||||
}
|
||||
|
||||
.u-modal__button-group__wrapper--hover {
|
||||
background: #0EBB5B !important;
|
||||
}
|
||||
</style>
|
||||
16
packageMy/browseHistory/browseHistory.vue
Normal file
@@ -0,0 +1,16 @@
|
||||
<template>
|
||||
<view>
|
||||
<productsBtn :type="2" ref="browseHistory"></productsBtn>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
type: ''
|
||||
}
|
||||
},
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
116
packageMy/changeAvatar/changeAvatar.vue
Normal file
@@ -0,0 +1,116 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="change_avatar">
|
||||
<u-avatar :src="avatar" size="140rpx" shape="circle" @click="changeAvatar()"></u-avatar>
|
||||
</view>
|
||||
<view>
|
||||
<u--form labelPosition="left" :model="model">
|
||||
<u-form-item label="修改昵称" prop="userInfo.name" borderBottom>
|
||||
<u--input v-model="model.userInfo.name" border="none" placeholder="请输入您的昵称"
|
||||
placeholderStyle="color: #CCCCCC;font-size: 24rpx;"></u--input>
|
||||
</u-form-item>
|
||||
</u--form>
|
||||
<view style="height: 230rpx;"></view>
|
||||
<u-button type="success" text="确定" color="#0EBB5B" @click="handleSubmit()"></u-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
apiService
|
||||
} from '../../service/request'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
avatar: '',
|
||||
avatarUrl: '',
|
||||
model: {
|
||||
userInfo: {
|
||||
name: ''
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getUser()
|
||||
},
|
||||
methods: {
|
||||
//获取头像昵称
|
||||
getUser() {
|
||||
this.$apiServe.getUser().then(res => {
|
||||
var data = res.data.data
|
||||
console.log('头像昵称', res);
|
||||
if (data) {
|
||||
this.avatar = uni.getStorageSync('img_url') + data.avatar
|
||||
this.avatarUrl = '/' + data.avatar
|
||||
this.model.userInfo.name = data.nickname
|
||||
}
|
||||
}).finally(_ => {})
|
||||
},
|
||||
updatePromise(filePath) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const token = uni.getStorageSync('loginToken')
|
||||
const a = uni.uploadFile({
|
||||
url: apiService.uploadImgUrl,
|
||||
filePath: filePath,
|
||||
name: 'file',
|
||||
header: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
'Authorization': token
|
||||
},
|
||||
success: (res) => {
|
||||
resolve(JSON.parse(res.data).data.url)
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
//点击头像修改
|
||||
changeAvatar() {
|
||||
uni.chooseImage({ // 从本地相册选择图片或使用相机拍照。
|
||||
count: 1, //默认选择1张图片
|
||||
sizeType: ['original', 'compressed'], //original 原图,compressed 压缩图,默认二者都有
|
||||
success: (res) => {
|
||||
// console.log(res.tempFilePaths[0]); //成功则返回图片的本地文件路径列表 tempFilePaths
|
||||
this.avatar = res.tempFilePaths[0] //更新本地浏览头像图片
|
||||
if (res.tempFilePaths[0]) {
|
||||
const result = this.updatePromise(res.tempFilePaths[0]) //上传图片
|
||||
result.then(value => {
|
||||
this.avatarUrl = '/' + value
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
//提交头像和昵称
|
||||
handleSubmit() {
|
||||
this.$apiServe.updateUser({
|
||||
nickname: this.model.userInfo.name,
|
||||
avatar: this.avatarUrl
|
||||
}).then(res => {
|
||||
console.log('修改头像昵称==', res);
|
||||
this.$toast.success(res.data.msg)
|
||||
uni.reLaunch({
|
||||
url: '/pages/my/my'
|
||||
})
|
||||
}).finally(_ => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.change_avatar {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin: 60rpx 0;
|
||||
}
|
||||
|
||||
.u-button {
|
||||
width: 644rpx !important;
|
||||
height: 86rpx !important;
|
||||
background: #0EBB5B;
|
||||
border-radius: 20rpx !important;
|
||||
}
|
||||
</style>
|
||||
133
packageMy/memberCenter/memberCenter.vue
Normal file
@@ -0,0 +1,133 @@
|
||||
<template>
|
||||
<view>
|
||||
<u-navbar :autoBack="true" title="会员中心"></u-navbar>
|
||||
<u--image src="/static/my/wo_icon_hyzxbj.png" width="750rpx" height="349rpx" :lazy-load="true">
|
||||
</u--image>
|
||||
<myAvatar ref="myavatar" :center="show"></myAvatar>
|
||||
<view style="height: 56rpx;"></view>
|
||||
<myForm ref="nameAndphone"></myForm>
|
||||
<view class="commitment">
|
||||
{{commitment}}
|
||||
</view>
|
||||
<u-button type="success" :text="btnText" color="#0EBB5B" @click="handleSureClick()" :disabled="btnDisabled">
|
||||
</u-button>
|
||||
<u-modal :show="showM" closeOnClickOverlay="false" confirmText="确定" @confirm="confirm">
|
||||
<rich-text :nodes="content"></rich-text>
|
||||
</u-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
name: '',
|
||||
phone: '',
|
||||
showM: false,
|
||||
btnText: '升级VIP',
|
||||
btnDisabled: false,
|
||||
//部分产品无权限访问,需升级VIP
|
||||
needAsk: '',
|
||||
//会员中心的用户名旁边不显示edit图标
|
||||
show: false,
|
||||
content: `请保持手机畅通<br>
|
||||
客服会及时联系您`,
|
||||
commitment: ''
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
if (uni.getStorageSync('member') == 2) {
|
||||
this.btnText = '升级VIP'
|
||||
} else if (uni.getStorageSync('member') == 3) {
|
||||
this.btnText = '升级vip,正在审核中'
|
||||
this.btnDisabled = true
|
||||
} else if (uni.getStorageSync('member') == 4) {
|
||||
this.btnText = '升级VIP'
|
||||
this.btnDisabled = true
|
||||
}
|
||||
this.commitment = uni.getStorageSync('agreement')
|
||||
if (option.ask == 1) {
|
||||
this.needAsk = option.ask
|
||||
}
|
||||
if (uni.getStorageSync('com_name') && uni.getStorageSync('com_mobile')) {
|
||||
if (uni.getStorageSync('member') == 3 || uni.getStorageSync('member') == 4) {
|
||||
this.$refs.nameAndphone.model.userInfo.name = uni.getStorageSync('com_name')
|
||||
this.$refs.nameAndphone.model.userInfo.phone = uni.getStorageSync('com_mobile')
|
||||
this.$refs.nameAndphone.disabled = true
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleSureClick() {
|
||||
if (this.btnDisabled == false) {
|
||||
let name = this.$refs.nameAndphone.model.userInfo.name
|
||||
let phone = this.$refs.nameAndphone.model.userInfo.phone
|
||||
console.log('name', name);
|
||||
console.log('phone', phone);
|
||||
|
||||
if (!/^1[3456789]\d{9}$/.test(phone)) {
|
||||
this.$toast.warn('请输入正确的手机号')
|
||||
return false
|
||||
}
|
||||
if (name == '') {
|
||||
this.$toast.warn('请完善数据')
|
||||
return false
|
||||
}
|
||||
if (name && phone) {
|
||||
console.log('数据已完善');
|
||||
this.$apiServe.bindComponyAndUpdate({
|
||||
uid: uni.getStorageSync('user_id'),
|
||||
type: 2,
|
||||
companyName: name,
|
||||
companyPhone: phone
|
||||
}).then(res => {
|
||||
console.log('升级VIP', res.data);
|
||||
if (res.data.code == 20003) {
|
||||
this.showM = true
|
||||
} else if (res.data.code == 20005) {
|
||||
this.$toast.warn('请完善数据')
|
||||
}
|
||||
}).finally(_ => {})
|
||||
}
|
||||
}
|
||||
},
|
||||
confirm() {
|
||||
uni.reLaunch({
|
||||
url: '/pages/my/my'
|
||||
})
|
||||
if (this.needAsk == 1) {
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.commitment {
|
||||
font-size: 26rpx;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #C8C8C8;
|
||||
line-height: 30rpx;
|
||||
margin: 40rpx 66rpx;
|
||||
}
|
||||
|
||||
.u-button {
|
||||
width: 644rpx !important;
|
||||
height: 86rpx !important;
|
||||
background: #0EBB5B;
|
||||
border-radius: 20rpx !important;
|
||||
}
|
||||
|
||||
.u-modal__content {
|
||||
padding: 43rpx 104rpx !important;
|
||||
text-indent: 14rpx;
|
||||
}
|
||||
|
||||
.u-modal__button-group__wrapper--hover {
|
||||
background: #0EBB5B !important;
|
||||
}
|
||||
</style>
|
||||
17
packageMy/myCollection/myCollection.vue
Normal file
@@ -0,0 +1,17 @@
|
||||
<template>
|
||||
<view>
|
||||
<productsBtn :type="1"></productsBtn>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
type: '',
|
||||
isLoad: true,
|
||||
}
|
||||
},
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
255
packageMy/myRelease/myRelease.vue
Normal file
@@ -0,0 +1,255 @@
|
||||
<template>
|
||||
<view>
|
||||
<view>
|
||||
<u-tabs :list="tabsList" :scrollable="false" lineColor="#0A994A" color="#969696"
|
||||
activeStyle="color:#15CA65;font-weight: bold;" :current="tabCurrent" @change="tabChange"></u-tabs>
|
||||
</view>
|
||||
<view v-if="tabCurrent == 0" style="background-color: #fff;">
|
||||
<view v-for="(item,index) in needsList" :key="index" class="my_line"
|
||||
style="padding: 24rpx 19rpx;border-bottom: 1px solid #EEEEEE;">
|
||||
<text class="needs_text">{{item.desc}}</text>
|
||||
|
||||
<view class="time_line">
|
||||
<view class="release_time">
|
||||
<text v-if="updateIndex==0||updateIndex==1">{{item.update_time}}</text>
|
||||
<text v-else>{{item.update_time}}</text>
|
||||
</view>
|
||||
<view style="display: flex;">
|
||||
<view class="btn" @click="viewIdeasOrNeeds(item)" v-if="item.status==1">
|
||||
<u-icon name="eye" color="#15CA65" size="20"></u-icon>
|
||||
<text class="btn_text">查看</text>
|
||||
</view>
|
||||
<view class="btn" @click="editIdeasAndNeeds(item)" v-if="item.status==0">
|
||||
<u-icon name="edit-pen" color="#15CA65" size="20"></u-icon>
|
||||
<text class="btn_text">修改</text>
|
||||
</view>
|
||||
<view class="btn" @click="deleteIdeasAndNeeds(item)" v-if="item.status==0">
|
||||
<u-icon name="trash" color="#15CA65" size="20"></u-icon>
|
||||
<text class="btn_text">删除</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="tabCurrent == 1" style="background-color: #fff;">
|
||||
<view v-for="(item,index) in ideasList" :key="index" class="my_line"
|
||||
style="padding: 24rpx 19rpx;border-bottom: 1px solid #EEEEEE;">
|
||||
<text class="needs_text">{{item.pname}}</text>
|
||||
<view class="time_line">
|
||||
<view class="release_time">
|
||||
|
||||
<text v-if="updateIndex==0||updateIndex==1">{{item.update_time}}</text>
|
||||
<text v-else>{{item.update_time}}</text>
|
||||
</view>
|
||||
<view style="display: flex;">
|
||||
<view class="btn" @click="viewIdeasOrNeeds(item)" v-if="item.status==1">
|
||||
<u-icon name="eye" color="#15CA65" size="20"></u-icon>
|
||||
<text class="btn_text">查看</text>
|
||||
</view>
|
||||
<view class="btn" @click="editIdeasAndNeeds(item)" v-if="item.status==0">
|
||||
<u-icon name="edit-pen" color="#15CA65" size="20"></u-icon>
|
||||
<text class="btn_text">修改</text>
|
||||
</view>
|
||||
<view class="btn" @click="deleteIdeasAndNeeds(item)" v-if="item.status==0">
|
||||
<u-icon name="trash" color="#15CA65" size="20"></u-icon>
|
||||
<text class="btn_text">删除</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;"
|
||||
v-if="needsList.length==0&&tabCurrent == 0">
|
||||
暂无更多记录</view>
|
||||
<view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;"
|
||||
v-if="ideasList.length==0&&tabCurrent == 1">
|
||||
暂无更多记录</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
dateFormatXwDetail
|
||||
} from '../../utills/date.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// id: '',
|
||||
// showM: false,
|
||||
content: '您确定删除吗?',
|
||||
tabCurrent: 0,
|
||||
type: 1,
|
||||
tabsList: [{
|
||||
name: '需求发布'
|
||||
}, {
|
||||
name: '创意发布'
|
||||
}],
|
||||
needsList: [],
|
||||
ideasList: [],
|
||||
updateIndex: ''
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
if (options && options.index) {
|
||||
options.index = options.index - 1
|
||||
this.updateIndex = options.index
|
||||
this.tabChange(options)
|
||||
return
|
||||
}
|
||||
this.getIdeasAndNeeds()
|
||||
},
|
||||
methods: {
|
||||
//获取创意发布或需求发布
|
||||
getIdeasAndNeeds() {
|
||||
this.$apiServe.getIdeasAndNeeds(this.type).then(res => {
|
||||
let data = res.data.data
|
||||
console.log('创意需求发布数据', res.data);
|
||||
for (const item of data) {
|
||||
item.pub_time = dateFormatXwDetail(item.pub_time)
|
||||
item.update_time = dateFormatXwDetail(item.update_time)
|
||||
const imagesList = item.images && item.images.length > 0 ? item.images.split(';') : []
|
||||
item.images = imagesList.map(item1 => {
|
||||
item1 = uni.getStorageSync('img_url') + '/' + item1
|
||||
return item1
|
||||
})
|
||||
}
|
||||
if (this.type == 1) {
|
||||
this.needsList = data
|
||||
} else if (this.type == 2) {
|
||||
this.ideasList = data
|
||||
}
|
||||
}).finally(_ => {
|
||||
|
||||
})
|
||||
},
|
||||
//切换需求发布和创意发布
|
||||
tabChange(data) {
|
||||
this.tabCurrent = data.index
|
||||
if (data.index == 0) {
|
||||
this.type = 1
|
||||
} else if (data.index == 1) {
|
||||
this.type = 2
|
||||
}
|
||||
this.getIdeasAndNeeds()
|
||||
},
|
||||
//查看需求发布或创意发布
|
||||
viewIdeasOrNeeds(item) {
|
||||
const tabCurrent = this.tabCurrent
|
||||
uni.removeStorage({ //删除Storage
|
||||
key: 'update_item',
|
||||
success: () => {
|
||||
uni.setStorageSync('update_item', item);
|
||||
uni.reLaunch({
|
||||
url: '/pages/ideasAndNeeds/ideasAndNeeds?item=update_item' + '&index=' +
|
||||
tabCurrent + '&view=' + 11
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
//修改我的需求
|
||||
editIdeasAndNeeds(item) {
|
||||
const tabCurrent = this.tabCurrent
|
||||
uni.removeStorage({ //删除Storage
|
||||
key: 'update_item',
|
||||
success: () => {
|
||||
uni.setStorageSync('update_item', item);
|
||||
uni.reLaunch({
|
||||
url: '/pages/ideasAndNeeds/ideasAndNeeds?item=update_item' + '&index=' +
|
||||
tabCurrent
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
//二次确认删除我的需求或创意
|
||||
deleteIdeasAndNeeds(item) {
|
||||
var that = this
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '你确定要删除吗',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
that.$apiServe.deleteIdeasAndNeeds(item.id).then(res => {
|
||||
if (res.data.code == 1) {
|
||||
that.$toast.warn('删除成功')
|
||||
}
|
||||
that.getIdeasAndNeeds()
|
||||
}).finally(_ => {
|
||||
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
that.$toast.warn('取消删除')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.u-modal__content {
|
||||
padding: 43rpx 104rpx !important;
|
||||
text-indent: 25rpx;
|
||||
}
|
||||
|
||||
|
||||
.u-tabs {
|
||||
margin-bottom: 10rpx;
|
||||
|
||||
.u-tabs__wrapper__nav {
|
||||
background-color: #FFFFFF;
|
||||
|
||||
.u-tabs__wrapper__nav__item {
|
||||
padding: 0 !important;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.my_line:last-child {
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
.needs_text {
|
||||
font-size: 30rpx;
|
||||
font-family: PingFangSC-Medium, PingFang SC;
|
||||
font-weight: 500;
|
||||
color: #3E3E3E;
|
||||
line-height: 42rpx;
|
||||
-webkit-line-clamp: 2;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.time_line {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: 14rpx;
|
||||
font-size: 24rpx;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
|
||||
.release_time {
|
||||
color: #969696;
|
||||
}
|
||||
|
||||
.btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-left: 40rpx;
|
||||
|
||||
.u-icon__icon {
|
||||
top: 1px !important;
|
||||
}
|
||||
|
||||
.btn_text {
|
||||
|
||||
color: #15CA65;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
120
packageReport/certifiedCj/certifiedCj.vue
Normal file
@@ -0,0 +1,120 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="xw_content" v-for="(item,index) in cjsList" :key="index" @click="clickCj(item)">
|
||||
<u--image :src="imgUrl+item.cover" width="112rpx" height="112rpx" :lazy-load="true">
|
||||
</u--image>
|
||||
<view class="xw_right">
|
||||
<view class="xw_title">
|
||||
{{item.name}}
|
||||
</view>
|
||||
<view style="display: flex;">
|
||||
<!-- <text class="cj_tags" v-for="(tagsItem,tagsIndex) in item.tags" :key="tagsIndex">
|
||||
{{tagsItem.tag}}
|
||||
</text> -->
|
||||
<text class="cj_tags">{{item.tag}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="cjsShow==0" class="no-data">已经到底啦!</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
cjsShow: '',
|
||||
cjsList: [],
|
||||
imgUrl: '',
|
||||
pageNum: 1, // 当前页
|
||||
pageSize: 12, // 每页条数
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
this.getCertifiedCj()
|
||||
},
|
||||
onReachBottom() {
|
||||
console.log('触底下拉');
|
||||
if (this.cjsShow !== 0) {
|
||||
this.pageNum++
|
||||
this.getCertifiedCj()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 获取认证厂家列表
|
||||
getCertifiedCj() {
|
||||
this.$apiServe.getCertifiedCj({
|
||||
pageSize: this.pageSize,
|
||||
pageNum: this.pageNum
|
||||
}).then(res => {
|
||||
console.log('认证厂家', res)
|
||||
let cjsData = res.data.data
|
||||
for (const item of cjsData) {
|
||||
this.cjsShow = item.length
|
||||
console.log('this.cjsShow', this.cjsShow);
|
||||
}
|
||||
this.cjsList = [...this.cjsList, ...res.data.data]
|
||||
}).finally(_ => {})
|
||||
},
|
||||
// 跳转到认证厂家详情页
|
||||
clickCj(item) {
|
||||
uni.navigateTo({
|
||||
url: '../certifiedCjDetail/certifiedCjDetail?id=' + item.id
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background: #FFFFFF;
|
||||
}
|
||||
|
||||
.no-data {
|
||||
text-align: center;
|
||||
margin-top: 29rpx;
|
||||
font-size: 20rpx;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #BBBBBB;
|
||||
line-height: 28rpx;
|
||||
}
|
||||
|
||||
.xw_content {
|
||||
background: #FFFFFF;
|
||||
border: 1rpx solid #EEEEEE;
|
||||
display: flex;
|
||||
padding: 29rpx 19rpx;
|
||||
|
||||
.xw_right {
|
||||
padding-left: 19rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.xw_title {
|
||||
font-size: 30rpx;
|
||||
font-family: PingFangSC-Medium, PingFang SC;
|
||||
font-weight: bold;
|
||||
color: #3E3E3E;
|
||||
line-height: 42rpx;
|
||||
-webkit-line-clamp: 2;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.cj_tags {
|
||||
font-size: 24rpx;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #969696;
|
||||
line-height: 33rpx;
|
||||
padding-right: 10rpx;
|
||||
margin-top: 35rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
231
packageReport/certifiedCjDetail/certifiedCjDetail.vue
Normal file
@@ -0,0 +1,231 @@
|
||||
<template>
|
||||
<view>
|
||||
<view style="position: relative;padding-bottom: 50rpx;">
|
||||
<u-image :src="imgUrl+detailList.cover" width="750rpx" height="290rpx">
|
||||
</u-image>
|
||||
<view class="feature">
|
||||
<text class="one_title">经营范围及特色</text>
|
||||
<view class="green_block">
|
||||
<text class="green_features">{{detailList.desc}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="introduce">
|
||||
<view class="introduce_title">企业介绍</view>
|
||||
<u-parse :content="detailList.content"></u-parse>
|
||||
</view>
|
||||
<view class="show">
|
||||
<view class="introduce_title">企业展示</view>
|
||||
<u-grid :border="false" col="4">
|
||||
<u-grid-item v-for="(listItem,listIndex) in detailList.images" :key="listIndex">
|
||||
<u--image :src="imgUrl+listItem" width="170rpx" height="170rpx" :lazy-load="true">
|
||||
</u--image>
|
||||
</u-grid-item>
|
||||
</u-grid>
|
||||
</view>
|
||||
</view>
|
||||
<view class="footer" @click="showModal()">
|
||||
<u-icon name="kefu-ermai" color="#fff" size="30rpx"></u-icon>
|
||||
<text>联系客服</text>
|
||||
</view>
|
||||
<u-modal :show="showCall" showCancelButton closeOnClickOverlay="false" confirmText="是" cancelText="否"
|
||||
@confirm="confirmCall" @cancel="cancelCall">
|
||||
<view>
|
||||
<view style="text-indent: 25rpx;">{{mobile}}</view>
|
||||
<text>是否拨打客服电话</text>
|
||||
</view>
|
||||
</u-modal>
|
||||
<view style="margin:0 20rpx;">
|
||||
<u-overlay :show="!isLoad">
|
||||
<login @success="reOnLoad()" @fail="failToLoad()"></login>
|
||||
</u-overlay>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import login from 'pages/my/login/login'
|
||||
export default {
|
||||
components: {
|
||||
login
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
id: '',
|
||||
detailList: [],
|
||||
imgUrl: '',
|
||||
isLoad: true,
|
||||
showCall: false,
|
||||
mobile: '',
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
this.id = option.id
|
||||
this.getCertifiedCjDetail()
|
||||
this.getCsTel()
|
||||
// if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
|
||||
// this.isLoad = false
|
||||
// return
|
||||
// }
|
||||
// this.isLoad = true
|
||||
},
|
||||
methods: {
|
||||
//获取客服电话
|
||||
getCsTel() {
|
||||
this.$apiServe.getCsTel().then(res => {
|
||||
this.mobile = res.data.data.cs_tel
|
||||
}).finally(_ => {})
|
||||
},
|
||||
//获取认证厂家详情
|
||||
getCertifiedCjDetail() {
|
||||
this.$apiServe.getCertifiedCjDetail(this.id).then(res => {
|
||||
if (res.data.code === -1) {
|
||||
this.isLoad = false
|
||||
}
|
||||
console.log('认证厂家详情页', res.data)
|
||||
if (res.data.data) {
|
||||
let data = res.data.data
|
||||
if (data.images) {
|
||||
data.images = data.images.split(';')
|
||||
}
|
||||
this.detailList = data
|
||||
} else {
|
||||
this.$toast.warn('没有更多详情了')
|
||||
}
|
||||
}).finally(_ => {})
|
||||
},
|
||||
reOnLoad() {
|
||||
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
|
||||
this.$toast.warn('登录失败请重试')
|
||||
this.isLoad = false
|
||||
return
|
||||
}
|
||||
this.isLoad = true
|
||||
this.getCertifiedCjDetail()
|
||||
},
|
||||
failToLoad() {
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
},
|
||||
// 联系客服模态框
|
||||
showModal() {
|
||||
this.showCall = true
|
||||
},
|
||||
confirmCall() {
|
||||
this.showCall = false
|
||||
let phone = this.mobile
|
||||
phone = phone.toString()
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: phone,
|
||||
success: function() {
|
||||
console.log('拨打电话成功');
|
||||
},
|
||||
fail() {
|
||||
console.log('打电话失败了');
|
||||
}
|
||||
})
|
||||
},
|
||||
cancelCall() {
|
||||
this.showCall = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.u-modal__content {
|
||||
padding: 43rpx 104rpx !important;
|
||||
text-indent: 25rpx;
|
||||
}
|
||||
|
||||
.feature {
|
||||
padding: 20rpx 16rpx;
|
||||
background-color: #fff;
|
||||
margin-bottom: 30rpx;
|
||||
|
||||
.one_title {
|
||||
font-size: 28rpx;
|
||||
font-family: PingFangSC-Medium, PingFang SC;
|
||||
font-weight: bold;
|
||||
color: #3E3E3E;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
|
||||
.green_block {
|
||||
background-color: #16CA65;
|
||||
margin-top: 20rpx;
|
||||
|
||||
height: 139rpx;
|
||||
border-radius: 6rpx;
|
||||
|
||||
.green_features {
|
||||
font-size: 24rpx;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #FFFFFF;
|
||||
line-height: 33rpx;
|
||||
margin-left: 20rpx;
|
||||
margin-top: 14rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.introduce {
|
||||
padding: 20rpx 16rpx;
|
||||
background-color: #fff;
|
||||
margin-bottom: 30rpx;
|
||||
|
||||
.introduce_title {
|
||||
font-size: 28rpx;
|
||||
font-family: PingFangSC-Medium, PingFang SC;
|
||||
font-weight: bold;
|
||||
color: #3E3E3E;
|
||||
line-height: 40rpx;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.business_introduce {
|
||||
font-size: 24rpx;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #666666;
|
||||
line-height: 33rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.show {
|
||||
padding: 20rpx 16rpx;
|
||||
background-color: #fff;
|
||||
margin-bottom: 78rpx;
|
||||
|
||||
.u-grid {
|
||||
padding-top: 22rpx !important;
|
||||
}
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 100rpx;
|
||||
background: #0EBB5B;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-content: center;
|
||||
text-align: center;
|
||||
|
||||
.u-icon {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
text {
|
||||
font-size: 20rpx;
|
||||
font-family: MicrosoftYaHei-Bold, MicrosoftYaHei;
|
||||
font-weight: bold;
|
||||
color: #FFFFFF;
|
||||
line-height: 26rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
30
packageReport/newProductRelease/newProductRelease.vue
Normal file
@@ -0,0 +1,30 @@
|
||||
<template>
|
||||
<view>
|
||||
<productsByThumb ref="productsByThumb" :reportPageSize="6" @getThumbLength="getThumbLength"></productsByThumb>
|
||||
<view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;"
|
||||
v-show="reachBottomLength===0||reachBottomLength<=4">
|
||||
没有更多数据了</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
reachBottomLength: '',
|
||||
reportPageSize: ''
|
||||
}
|
||||
},
|
||||
onReachBottom() {
|
||||
this.$refs.productsByThumb.pageSize = 4
|
||||
this.$refs.productsByThumb.pageNum++
|
||||
this.$refs.productsByThumb.getProductsByThumb()
|
||||
},
|
||||
methods: {
|
||||
//获取按上架时间排列的产品列表length
|
||||
getThumbLength(e) {
|
||||
this.reachBottomLength = e
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
97
packageReport/newsDetail/newsDetail.vue
Normal file
@@ -0,0 +1,97 @@
|
||||
<template>
|
||||
<view style="padding: 12rpx 16rpx;">
|
||||
<view class="xwD_title">
|
||||
{{detailList.title}}
|
||||
</view>
|
||||
<view style="display: flex;">
|
||||
<text class="xwD_time">
|
||||
{{detailList.pub_time}}
|
||||
</text>
|
||||
<text class="xwD_time xwD_place">
|
||||
{{detailList.pub_name}}
|
||||
</text>
|
||||
</view>
|
||||
<view class="xwD_content">
|
||||
<u-parse :content="detailList.content" @preview="preview" @navigate="navigate"></u-parse>
|
||||
</view>
|
||||
<!-- <u-modal :show="showM" closeOnClickOverlay="false" confirmText="确定" @confirm="confirm">
|
||||
<rich-text :nodes="content"></rich-text>
|
||||
</u-modal> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
dateFormatXwDetail
|
||||
} from '../../utills/date.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
id: '',
|
||||
detailList: [],
|
||||
// showM: false,
|
||||
// content: `该新闻已下架!`,
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.id = option.id
|
||||
this.getNewsDetail()
|
||||
},
|
||||
methods: {
|
||||
//获取行业新闻详情
|
||||
getNewsDetail() {
|
||||
this.$apiServe.getNewsDetail(this.id).then(res => {
|
||||
console.log('新闻详情', res.data);
|
||||
if (res.data.code == 0 || res.data.msg == "该新闻已下架!") {
|
||||
this.$toast.warn('该新闻已下架!')
|
||||
// this.showM = true
|
||||
}
|
||||
if (res.data.data) {
|
||||
let detail = res.data.data
|
||||
detail.pub_time = dateFormatXwDetail(detail.pub_time)
|
||||
this.detailList = res.data.data
|
||||
}
|
||||
|
||||
}).finally(_ => {})
|
||||
},
|
||||
// confirm() {
|
||||
// uni.reLaunch({
|
||||
// url: '/pages/index/index'
|
||||
// })
|
||||
// }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.xwD_title {
|
||||
font-size: 38rpx;
|
||||
font-family: PingFangSC-Medium, PingFang SC;
|
||||
font-weight: bold;
|
||||
color: #3E3E3E;
|
||||
line-height: 53rpx;
|
||||
letter-spacing: 1rpx;
|
||||
}
|
||||
|
||||
.xwD_time {
|
||||
font-size: 24rpx;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #969696;
|
||||
line-height: 33rpx;
|
||||
margin-top: 6rpx;
|
||||
}
|
||||
|
||||
.xwD_place {
|
||||
padding-left: 20rpx;
|
||||
}
|
||||
|
||||
.xwD_content {
|
||||
margin-top: 38rpx;
|
||||
// border: none;
|
||||
}
|
||||
</style>
|
||||
89
packageReport/newsList/newsList.vue
Normal file
@@ -0,0 +1,89 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="xw_content" v-for="(item,index) in newsList" :key="index" @click="clickNews(item)">
|
||||
<u--image :src="imgUrl+item.cover" width="192rpx" height="122rpx" :lazy-load="true">
|
||||
</u--image>
|
||||
<view class="xw_right">
|
||||
<view class="xw_title">
|
||||
{{item.title}}
|
||||
</view>
|
||||
<view style="display: flex;">
|
||||
<text class="xw_time">
|
||||
{{item.pub_time_str}}
|
||||
</text>
|
||||
<text class="xw_time xw_place">
|
||||
{{item.pub_name}}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="newsShow==0" class="no-data">已经到底啦!</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
dateFormat
|
||||
} from '../../utills/date.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
newsShow: '',
|
||||
imgUrl: '',
|
||||
newsList: [],
|
||||
pageNum: 1, // 当前页
|
||||
pageSize: 12, // 每页条数
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
this.getNews()
|
||||
},
|
||||
onReachBottom() {
|
||||
console.log('触底下拉');
|
||||
if (this.newsShow !== 0) {
|
||||
this.pageNum++
|
||||
this.getNews()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getNews() {
|
||||
this.$apiServe.getNews({
|
||||
pageSize: this.pageSize,
|
||||
pageNum: this.pageNum
|
||||
}).then(res => {
|
||||
console.log('行业新闻', res.data)
|
||||
let newsData = res.data.data
|
||||
for (const item of newsData) {
|
||||
item.pub_time_str = dateFormat(item.pub_time_str)
|
||||
this.newsShow = item.length
|
||||
console.log('this.newsShow', this.newsShow);
|
||||
}
|
||||
this.newsList = [...this.newsList, ...newsData]
|
||||
}).finally(_ => {})
|
||||
},
|
||||
// 跳转到新闻详情页
|
||||
clickNews(item) {
|
||||
uni.navigateTo({
|
||||
url: '../newsDetail/newsDetail?id=' + item.id
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background: #FFFFFF;
|
||||
}
|
||||
|
||||
.no-data {
|
||||
text-align: center;
|
||||
margin-top: 29rpx;
|
||||
font-size: 20rpx;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #BBBBBB;
|
||||
line-height: 28rpx;
|
||||
}
|
||||
</style>
|
||||
814
packageSearch/goods-category-search/category-index.vue
Normal file
@@ -0,0 +1,814 @@
|
||||
<template>
|
||||
<view :style="{height: windowHeight + 'px', overflow:showMask? 'hidden':'auto'}">
|
||||
<!-- 顶部导航栏 -->
|
||||
<view class="top-search">
|
||||
<customer-searchbar ref="search" :readOnly="true" :search-bar-top="searchBarTop"
|
||||
:search-bar-height="searchBarHeight" @navigate="navigateToSearch" @back="goBack" />
|
||||
</view>
|
||||
<view :style="{marginTop: Number(searchBarTop + searchBarHeight + 2) + 'px',}">
|
||||
<view>
|
||||
<view class="category-view">
|
||||
<view class="left">
|
||||
<view v-for="(item,index) in categoryList" class="category-item"
|
||||
@click="changeSelectedCategory(item, index)">
|
||||
<view>
|
||||
<view class="icon-box">
|
||||
<image :src="item.icon" mode="aspectFit" class="icon"
|
||||
:style="{border: item.active?'2rpx #14CA65 solid':'0',}" />
|
||||
</view>
|
||||
<view class="name" :style="{width: item.active?'74px':'126rpx'}">
|
||||
<u-tag v-if="item.active" :text="item.name" bg-color="#14CA65" color="#fff"
|
||||
borderColor="#14CA65" shape="circle" />
|
||||
<text v-else class="no-active">{{item.name}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="right" @click="exportView('showMask')">
|
||||
<tex style="margin-bottom: 10rpx;">全部</tex>
|
||||
<u-icon size="14" name="/static/category/fl_icon_qb.png"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 类别详情-->
|
||||
<view id="category-detail" class="category-detail" :style="{height: listDataHeight + 'px'}">
|
||||
<scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view"
|
||||
:scroll-top="scrollTop">
|
||||
<view v-for="(item,index) in tabbar" :key="index" class="u-tab-item"
|
||||
:class="[menuCurrent==index ? 'u-tab-item-active' : '']" :data-current="index"
|
||||
@tap.stop="swichMenu(index)">
|
||||
<text class="title">{{item.name}}</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="category-last">
|
||||
<view class="category-tag-box">
|
||||
<scroll-view :scroll-x="true" class="left">
|
||||
<view v-for="(item,index) in tagsList" @click="changeSelectedTag(index)"
|
||||
class="category-tag">
|
||||
<view style="padding: 16rpx; border-radius: 10rpx;line-height: 32rpx;"
|
||||
:style="{color: index === tagCurrent ?'#14CA65':'#666', background: index === tagCurrent ?'#DBFFEB':'#EEEEEE'}">
|
||||
<text>{{item.name}}</text>
|
||||
</view>
|
||||
<!-- <u-tag v-if="index === tagCurrent" :text="item.name" bg-color="#DBFFEB" color="#14CA65" borderColor="#DBFFEB" shape="square" style="width: fit-content;"></u-tag> -->
|
||||
<!-- <u-tag v-else :text="item.name" bg-color="#EEEEEE" color="#666666" borderColor="#EEEEEE" shape="square" style="width: fit-content;"></u-tag> -->
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="right" @click="exportView('featureMask')">
|
||||
<u-icon size="10" name="/static/category/fl_icon_xl.png"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="category-order">
|
||||
<u-tabs :list="tabsList" :scrollable="false" lineWidth="30" lineColor="#0A994A"
|
||||
color="#969696"
|
||||
:activeStyle="{color: '#15CA65', fontWeight: '400', transform: 'scale(1.05)', size:'14px'}"
|
||||
lineHeight="4" :current="tabCurrent" @change="tabChange"></u-tabs>
|
||||
</view>
|
||||
<scroll-view scroll-y class="goods-list" @scrolltolower="reachGoodsBottom">
|
||||
<block v-for="(item1,index1) in goodsList" :key="index1">
|
||||
<view class="goods-item" @click="toDetailPage(item1)">
|
||||
<view class="left">
|
||||
<view class="image">
|
||||
<image :src="item1.imageF" mode="scaleToFill"
|
||||
style="width: 170rpx;height: 100%;"></image>
|
||||
</view>
|
||||
<view class="tag">
|
||||
<view class="tag-content">
|
||||
<text>{{item1.cate_name}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="name">
|
||||
<text>{{item1.name}}</text>
|
||||
</view>
|
||||
<view class="describe">
|
||||
<text>{{item1.title}}</text>
|
||||
</view>
|
||||
<view class="publish-date">
|
||||
<view class="publish-date-box">
|
||||
<view
|
||||
style="width: fit-content; display: inline-block;margin-right:6rpx;">
|
||||
<u-icon size="14" name="clock" color="#A3A3A3" />
|
||||
</view>
|
||||
<text style="margin-right: 6rpx;">发布日期</text>
|
||||
<text>{{item1.pub_time_str}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="tag">
|
||||
<template v-if="item1.tagList.length">
|
||||
<view class="tag-content">
|
||||
<text>{{ item1.tagList[0] }}</text>
|
||||
</view>
|
||||
</template>
|
||||
<!-- <view v-for="(tagObject, index) in item1.tagList" class="tag-content">
|
||||
<text>{{ tagObject }}</text>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<view class="bg" bindtap='hideview'
|
||||
:style="{display: showMask || featureMask ? 'block':'none', marginTop: Number(searchBarTop + searchBarHeight + 4) + 'px', height: Number(windowHeight - searchBarTop - searchBarHeight - 4) + 'px',}"
|
||||
@click="showMask = false, featureMask = false"></view>
|
||||
<view class="show" bindtap='hideview'
|
||||
:style="{display: showMask || featureMask ? 'block':'none', top: Number(searchBarTop + searchBarHeight + 4) + 'px',}">
|
||||
<view v-if="showMask" class="category-view-all">
|
||||
<view v-for="(item,index) in categoryList" @click="changeSelectedCategory(item,index)"
|
||||
style="width: 20%;margin-bottom: 20rpx;">
|
||||
<view class="category-item">
|
||||
<view class="icon-box">
|
||||
<image :src="item.icon" mode="aspectFit" class="icon"
|
||||
:style="{border: item.active?'2rpx #14CA65 solid':'0',}" />
|
||||
</view>
|
||||
<view class="name">
|
||||
<view v-if="item.active" class="active">
|
||||
<text>{{item.name}}</text>
|
||||
</view>
|
||||
<text v-else class="no-active">{{item.name}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="featureMask" class="category-view-all" style="align-content: start;">
|
||||
<view v-for="(item,index) in tagsList" @click="changeSelectedTag(index)" class="category-tag">
|
||||
<view style="padding: 16rpx; border-radius: 10rpx;line-height: 32rpx;"
|
||||
:style="{color: index === tagCurrent ?'#14CA65':'#666', background: index === tagCurrent ?'#DBFFEB':'#EEEEEE'}">
|
||||
<text>{{item.name}}</text>
|
||||
</view>
|
||||
<!-- <u-tag v-if="index === tagCurrent" :text="item.name" bg-color="#DBFFEB" color="#14CA65" borderColor="#DBFFEB" shape="square" style="width: fit-content;"></u-tag> -->
|
||||
<!-- <u-tag v-else :text="item.name" bg-color="#EEEEEE" color="#666666" borderColor="#EEEEEE" shape="square" style="width: fit-content;"></u-tag> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="arrow-up" @click="showMask = false, featureMask = false">
|
||||
<text style="margin-right: 4rpx;">点击收起</text>
|
||||
<u-icon size="15" name="arrow-up-fill"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- <uni-popup ref="popup" type="center" :animation="false">中间弹出 Popup</uni-popup> -->
|
||||
<!-- <u-popup v-model="showMask" mode="top" border-radius="14">
|
||||
<view style="margin-top: 200rpx;">出淤泥而不染,濯清涟而不妖</view>
|
||||
</u-popup> -->
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
searchBarTop: 0, //搜索栏的外边框高度,单位px
|
||||
searchBarHeight: 0, //搜索栏的高度,单位px
|
||||
windowHeight: 1,
|
||||
listDataHeight: 1, // 剩余高度
|
||||
queryParam: '',
|
||||
showMask: false,
|
||||
featureMask: false,
|
||||
categoryList: [],
|
||||
selectedCategory: 0,
|
||||
tabbar: [],
|
||||
goodsParam: {
|
||||
sortType: 0,
|
||||
cateId: 0,
|
||||
// tagIds: 0,
|
||||
pageSize: 10,
|
||||
pageNum: 1
|
||||
},
|
||||
goodsList: [],
|
||||
tabsList: [{
|
||||
name: '上架时间' // 上架时间(改)
|
||||
}, {
|
||||
name: '点赞量' // 点赞量(改)
|
||||
}],
|
||||
tagsList: [],
|
||||
scrollTop: 0, //tab标题的滚动条位置
|
||||
menuCurrent: 0, // 预设当前项的值
|
||||
menuHeight: 0, // 左边菜单的高度
|
||||
menuItemHeight: 0, // 左边菜单item的高度
|
||||
tabCurrent: 0, //分类详情 上架时间, // 左边菜单item的高度
|
||||
tagCurrent: null, //分类详情 上架时间
|
||||
imgUrl: '',
|
||||
isAllData: false
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
console.log(options)
|
||||
const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
|
||||
this.searchBarTop = menuButtonInfo.top;
|
||||
this.searchBarHeight = menuButtonInfo.height;
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
this.goodsList = []
|
||||
this.isAllData = false
|
||||
this.getCategoryList(options.categoryId)
|
||||
},
|
||||
onReady() {
|
||||
let that = this;
|
||||
uni.getSystemInfo({ //调用uni-app接口获取屏幕高度
|
||||
success(res) { //成功回调函数
|
||||
// windowHeight
|
||||
that.windowHeight = res.windowHeight //windoHeight为窗口高度,主要使用的是这个
|
||||
let titleH = uni.createSelectorQuery().select("#category-detail"); //想要获取高度的元素名(class/id)
|
||||
titleH.boundingClientRect(data => {
|
||||
let pH = that.windowHeight;
|
||||
that.listDataHeight = pH - data.top //计算高度:元素高度=窗口高度-元素距离顶部的距离(data.top)
|
||||
console.log(that.listDataHeight)
|
||||
}).exec()
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
//点击goodsItem跳转到详情页
|
||||
toDetailPage(item1) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/detail/productsDetail/productsDetail?id=' + item1.id
|
||||
})
|
||||
},
|
||||
goSearch(param) {
|
||||
this.queryParam = param
|
||||
const index = this.recentRecordList.findIndex(item => {
|
||||
return item === param
|
||||
})
|
||||
if (index > -1) {
|
||||
this.recentRecordList.splice(index, 1)
|
||||
}
|
||||
this.recentRecordList.unshift(param)
|
||||
},
|
||||
changeSelectedCategory(item, index) {
|
||||
this.$set(this.categoryList, this.selectedCategory, {
|
||||
...this.categoryList[this.selectedCategory],
|
||||
active: false
|
||||
});
|
||||
this.$set(this.categoryList, index, {
|
||||
...this.categoryList[index],
|
||||
active: true
|
||||
});
|
||||
this.selectedCategory = index
|
||||
this.tabCurrent = 0
|
||||
this.tagCurrent = null
|
||||
this.menuCurrent = 0
|
||||
this.getSeconedCategoryList()
|
||||
this.showMask = false
|
||||
},
|
||||
changeSelectedTag(index) {
|
||||
if(this.tagCurrent === index) {
|
||||
this.tagCurrent = null
|
||||
} else {
|
||||
this.tagCurrent = index
|
||||
}
|
||||
this.featureMask = false
|
||||
this.getGoodsList(true)
|
||||
},
|
||||
// 点击左边的栏目切换
|
||||
async swichMenu(index) {
|
||||
if (index == this.menuCurrent) return;
|
||||
this.menuCurrent = index;
|
||||
// 如果为0,意味着尚未初始化
|
||||
if (this.menuHeight == 0 || this.menuItemHeight == 0) {
|
||||
await this.getElRect('menu-scroll-view', 'menuHeight');
|
||||
await this.getElRect('u-tab-item', 'menuItemHeight');
|
||||
}
|
||||
// 将菜单菜单活动item垂直居中
|
||||
this.scrollTop = index * this.menuItemHeight + this.menuItemHeight / 2 - this.menuHeight / 2;
|
||||
this.getTagList()
|
||||
},
|
||||
// 获取一个目标元素的高度
|
||||
getElRect(elClass, dataVal) {
|
||||
new Promise((resolve, reject) => {
|
||||
const query = uni.createSelectorQuery().in(this);
|
||||
query.select('.' + elClass).fields({
|
||||
size: true
|
||||
}, res => {
|
||||
// 如果节点尚未生成,res值为null,循环调用执行
|
||||
if (!res) {
|
||||
setTimeout(() => {
|
||||
this.getElRect(elClass);
|
||||
}, 10);
|
||||
return;
|
||||
}
|
||||
this[dataVal] = res.height;
|
||||
}).exec();
|
||||
})
|
||||
},
|
||||
exportView(str) {
|
||||
if (str === 'showMask') {
|
||||
this.showMask = true
|
||||
} else if (str === 'featureMask') {
|
||||
this.featureMask = true
|
||||
}
|
||||
},
|
||||
tabChange(selectTab) {
|
||||
console.log(selectTab)
|
||||
this.tabCurrent = selectTab.index;
|
||||
this.getGoodsList(true)
|
||||
},
|
||||
navigateToSearch() {
|
||||
uni.navigateTo({
|
||||
url: '../search/search'
|
||||
})
|
||||
},
|
||||
getCategoryList(selectedCategoryId) {
|
||||
this.$apiServe.getCategories().then(res => {
|
||||
this.categoryList = res.data.data.map((item, index) => {
|
||||
item.icon = this.imgUrl + item.icon
|
||||
if (selectedCategoryId && selectedCategoryId === item.id) {
|
||||
item.active = true
|
||||
this.selectedCategory = index
|
||||
} else if (selectedCategoryId === null && this.selectedCategory && this
|
||||
.selectedCategory === index) {
|
||||
item.active = true
|
||||
active = true
|
||||
} else if (selectedCategoryId === null && !this.selectedCategory && !index) {
|
||||
item.active = true
|
||||
} else {
|
||||
item.active = false
|
||||
}
|
||||
return item
|
||||
})
|
||||
this.getSeconedCategoryList()
|
||||
}).finally(_ => {})
|
||||
},
|
||||
getSeconedCategoryList() {
|
||||
const data = {
|
||||
pid: this.categoryList[this.selectedCategory].id
|
||||
}
|
||||
this.$apiServe.getCategories(data).then(res => {
|
||||
this.tabbar = res.data.data.map((item, index) => {
|
||||
item.icon = this.imgUrl + item.icon
|
||||
return item
|
||||
})
|
||||
this.getTagList()
|
||||
}).finally(_ => {})
|
||||
},
|
||||
getTagList() {
|
||||
const data = {
|
||||
pid: 0// this.tabbar[this.menuCurrent].id
|
||||
}
|
||||
this.$apiServe.getTags(data).then(res => {
|
||||
this.tagsList = res.data.data.map((item, index) => {
|
||||
return item
|
||||
})
|
||||
}).finally(_ => {
|
||||
this.getGoodsList(true)
|
||||
})
|
||||
},
|
||||
getGoodsList(firstPage) {
|
||||
this.isAllData = false
|
||||
const data = {
|
||||
...this.goodsParam,
|
||||
sortType: this.tabCurrent + 1,
|
||||
cateId: this.tabbar.length ? this.tabbar[this.menuCurrent].id : 0,
|
||||
title: this.tagsList.length && (this.tagCurrent || this.tagCurrent === 0) ? this.tagsList[this.tagCurrent].name : ''
|
||||
// tagIds: this.tagsList.length ? this.tagsList[this.tagCurrent].id : 0
|
||||
}
|
||||
if (firstPage) {
|
||||
this.goodsList = []
|
||||
this.goodsParam.pageNum = 1
|
||||
}
|
||||
this.$apiServe.getProductList(data).then(res => {
|
||||
if (res.data.data.length > 0) {
|
||||
res.data.data.map((item, index) => {
|
||||
item.tagList = item.tags.split(',')
|
||||
item.imageF = this.imgUrl + item.images
|
||||
this.goodsList.push(item)
|
||||
// return item
|
||||
})
|
||||
} else {
|
||||
this.isAllData = true
|
||||
this.$toast.warn('暂无数据')
|
||||
}
|
||||
|
||||
}).finally(_ => {})
|
||||
},
|
||||
reachGoodsBottom() {
|
||||
console.log('-----触底')
|
||||
//触底事件
|
||||
if (!this.isAllData) {
|
||||
uni.showLoading({
|
||||
title: '加载中'
|
||||
});
|
||||
this.goodsParam.pageNum++
|
||||
this.getGoodsList(false)
|
||||
} else {
|
||||
this.$toast.warn('暂无数据')
|
||||
}
|
||||
setTimeout(() => {
|
||||
uni.hideLoading()
|
||||
}, 500)
|
||||
},
|
||||
goBack() {
|
||||
uni.navigateBack()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.top-search {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.category-view {
|
||||
height: fit-content;
|
||||
background-color: #F6F6F6;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
|
||||
.left {
|
||||
width: calc(100% - 60rpx);
|
||||
padding: 30rpx;
|
||||
display: flex;
|
||||
overflow: auto;
|
||||
|
||||
// flex-direction: row;
|
||||
// flex-wrap: wrap;
|
||||
// align-items: center;
|
||||
|
||||
.category-item {
|
||||
margin-right: 20rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
.icon-box {
|
||||
text-align: center;
|
||||
|
||||
.icon {
|
||||
width: 86rpx;
|
||||
height: 86rpx;
|
||||
padding: 4rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.name {
|
||||
// width: 126px;
|
||||
text-align: center;
|
||||
|
||||
.no-active {
|
||||
font-size: 24rpx;
|
||||
font-family: PingFang-SC-Medium, PingFang-SC;
|
||||
font-weight: 500;
|
||||
color: #616161;
|
||||
line-height: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
width: 60rpx;
|
||||
padding: 20rpx;
|
||||
background: #F6F6F6;
|
||||
border-left: 2rpx #F6F6F6 solid;
|
||||
box-shadow: -2px 0px 4px 0px rgba(218, 218, 218, 0.5);
|
||||
|
||||
font-size: 28rpx;
|
||||
font-family: PingFangSC-Medium, PingFang SC;
|
||||
font-weight: 500;
|
||||
color: #343434;
|
||||
line-height: 34rpx;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.category-detail {
|
||||
display: flex;
|
||||
background-color: #F5F5F5;
|
||||
|
||||
.u-tab-view {
|
||||
width: 210rpx;
|
||||
height: 100%;
|
||||
|
||||
.u-tab-item {
|
||||
height: 90rpx;
|
||||
background: #f6f6f6;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 26rpx;
|
||||
color: #444;
|
||||
font-weight: 400;
|
||||
line-height: 1;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #343434;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.u-tab-item-active {
|
||||
position: relative;
|
||||
color: #000;
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
background: #fff;
|
||||
border: 2rpx solid #fff;
|
||||
border-radius: 25% 0 0 0;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #14CA65;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.u-tab-item-active::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
border: 1rpx solid #14CA65;
|
||||
background-color: #14CA65;
|
||||
width: 1rpx;
|
||||
height: 14rpx;
|
||||
left: 27rpx;
|
||||
top: 37srpx;
|
||||
border-radius: 1rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.category-last {
|
||||
width: calc(100% - 206rpx);
|
||||
height: 100%;
|
||||
|
||||
.category-tag-box {
|
||||
background-color: #fff;
|
||||
height: 110rpx;
|
||||
display: flex;
|
||||
border-bottom: 1rpx solid #EEEEEE;
|
||||
|
||||
.left {
|
||||
width: calc(100% - 60rpx);
|
||||
padding: 12rpx;
|
||||
white-space: nowrap;
|
||||
overflow: auto;
|
||||
line-height: 90rpx;
|
||||
|
||||
.category-tag {
|
||||
margin-right: 15rpx;
|
||||
width: fit-content;
|
||||
display: inline-flex;
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
width: 60rpx;
|
||||
padding: 20rpx;
|
||||
background: #F6F6F6;
|
||||
border-left: 2rpx #F6F6F6 solid;
|
||||
box-shadow: -2px 0px 4px 0px rgba(218, 218, 218, 0.5);
|
||||
|
||||
font-size: 28rpx;
|
||||
font-family: PingFangSC-Medium, PingFang SC;
|
||||
font-weight: 500;
|
||||
color: #343434;
|
||||
line-height: 34rpx;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.category-order {
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
border-bottom: 1rpx solid #EEEEEE;
|
||||
}
|
||||
|
||||
.goods-list {
|
||||
background-color: #fff;
|
||||
height: calc(100% - 210rpx);
|
||||
|
||||
.goods-item {
|
||||
padding: 0;
|
||||
margin-bottom: 10rpx;
|
||||
display: flex;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0px 2px 3px 0px rgba(169, 169, 169, 0.2);
|
||||
border-bottom: 1px solid #EEEEEE;
|
||||
|
||||
.left {
|
||||
width: 190rpx;
|
||||
position: relative;
|
||||
|
||||
.image {
|
||||
padding: 20rpx;
|
||||
height: calc(100% - 40rpx)
|
||||
}
|
||||
|
||||
.tag {
|
||||
position: absolute;
|
||||
top: 26rpx;
|
||||
right: 0;
|
||||
float: right;
|
||||
|
||||
.tag-content {
|
||||
padding: 12rpx;
|
||||
border-radius: 25rpx 0 0 25rpx;
|
||||
line-height: 14rpx;
|
||||
background: linear-gradient(135deg, #0DB658 0%, #16DD6D 100%);
|
||||
color: #fff;
|
||||
font-size: 20rpx;
|
||||
width: fit-content;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
padding: 20rpx;
|
||||
height: calc(100% - 40rpx);
|
||||
|
||||
.name {
|
||||
font-size: 33rpx;
|
||||
font-family: PingFangSC-Medium, PingFang SC;
|
||||
font-weight: bold;
|
||||
color: #E10707;
|
||||
line-height: 46rpx;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.describe {
|
||||
font-size: 30rpx;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #3E3E3E;
|
||||
line-height: 37rpx;
|
||||
margin: 5rpx 0 10rpx 0;
|
||||
|
||||
word-break: break-all;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
/* 这里是超出几行省略 */
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.publish-date {
|
||||
color: #A3A3A3;
|
||||
font-size: 26rpx;
|
||||
line-height: 30rpx;
|
||||
margin: 14rpx 0 8rpx 0;
|
||||
|
||||
.publish-date-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.tag {
|
||||
line-height: 60rpx;
|
||||
// display: flex;
|
||||
// text-overflow: clip;
|
||||
// display: -webkit-box;
|
||||
// -webkit-box-orient: vertical;
|
||||
// /* 这里是超出几行省略 */
|
||||
// -webkit-line-clamp: 1;
|
||||
overflow: hidden;
|
||||
|
||||
.tag-content {
|
||||
display: inline;
|
||||
padding: 9rpx 17rpx;
|
||||
border-radius: 25rpx;
|
||||
line-height: 13rpx;
|
||||
background-color: #FDD96A;
|
||||
color: #fff;
|
||||
font-size: 22rpx;
|
||||
width: fit-content;
|
||||
// margin-right: 6rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bg {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 0%;
|
||||
left: 0%;
|
||||
width: 100%;
|
||||
background-color: black;
|
||||
z-index: 1001;
|
||||
-moz-opacity: 0.7;
|
||||
opacity: 0.70;
|
||||
filter: alpha(opacity=70);
|
||||
}
|
||||
|
||||
.show {
|
||||
display: none;
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
width: calc(100% - 20rpx);
|
||||
height: fit-content;
|
||||
padding: 20rpx 10rpx 0 10rpx;
|
||||
border: 1rpx solid #fff;
|
||||
background-color: #fff;
|
||||
border-radius: 0 0 20rpx 20rpx;
|
||||
z-index: 1002;
|
||||
overflow: auto;
|
||||
transition: all 2.4s;
|
||||
|
||||
.category-view-all {
|
||||
width: calc(100% - 20rpx);
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
border-bottom: 1px solid #EEEEEE;
|
||||
height: 360rpx;
|
||||
overflow: auto;
|
||||
transition: height 1.3s ease;
|
||||
|
||||
|
||||
.category-item {
|
||||
// display: flex;
|
||||
// flex-direction: column;
|
||||
// justify-content: center;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
.icon-box {
|
||||
text-align: center;
|
||||
|
||||
.icon {
|
||||
width: 90rpx;
|
||||
height: 90rpx;
|
||||
padding: 4rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.name {
|
||||
text-align: center;
|
||||
|
||||
.active {
|
||||
width: fit-content;
|
||||
font-size: 26rpx;
|
||||
text-align: center;
|
||||
padding: 6rpx;
|
||||
border-radius: 10rpx;
|
||||
line-height: 32rpx;
|
||||
color: #fff;
|
||||
background-color: #14CA65;
|
||||
}
|
||||
|
||||
.no-active {
|
||||
font-size: 26rpx;
|
||||
font-family: PingFang-SC-Medium, PingFang-SC;
|
||||
font-weight: 500;
|
||||
color: #616161;
|
||||
line-height: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.category-tag {
|
||||
margin-right: 17rpx;
|
||||
margin-bottom: 20rpx;
|
||||
width: fit-content;
|
||||
height: fit-content;
|
||||
display: inline-flex;
|
||||
}
|
||||
}
|
||||
|
||||
.arrow-up {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 28rpx;
|
||||
padding: 24rpx;
|
||||
line-height: 32rpx;
|
||||
}
|
||||
}
|
||||
|
||||
/deep/ .u-tag {
|
||||
flex: none;
|
||||
width: auto;
|
||||
}
|
||||
</style>
|
||||
87
packageSearch/search-products/search-products.vue
Normal file
@@ -0,0 +1,87 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="products_box">
|
||||
<u-grid :border="false" col="2">
|
||||
<u-grid-item v-for="(item,index) in productList" :key="index" @click="toDetailPage(item)">
|
||||
<u-image src="/static/products/sy_bb.png" width="354rpx" height="539rpx" :lazy-load="true">
|
||||
</u-image>
|
||||
<view class="bgContent">
|
||||
<view>
|
||||
<u-image :src="imgUrl+item.cover" width="346rpx" height="320rpx" :lazy-load="true">
|
||||
</u-image>
|
||||
<view class="img_tag">{{item.cate_name}}</view>
|
||||
</view>
|
||||
<view style="padding: 14rpx 24rpx 14rpx 16rpx;">
|
||||
<view class="title_box">
|
||||
<text class="title">{{item.name}}</text>
|
||||
<u-tag :text="item.tags" type="warning" shape="circle"></u-tag>
|
||||
</view>
|
||||
<view class="product_desc">
|
||||
{{item.title}}
|
||||
</view>
|
||||
<view class="releaseDate">
|
||||
<u-image src="/static/products/xp_icon_sjf.png" width="22rpx" height="22rpx"
|
||||
:lazy-load="true">
|
||||
</u-image>
|
||||
<text class="release">发布日期:</text>
|
||||
<text>{{item.pub_time_str}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-grid-item>
|
||||
</u-grid>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
queryParam: {
|
||||
pageSize: 10,
|
||||
pageNum: 1
|
||||
},
|
||||
queryTitle: null,
|
||||
imgUrl: null,
|
||||
productList: [],
|
||||
tagsArray: [],
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
this.queryTitle = options.title
|
||||
this.goSearch()
|
||||
},
|
||||
methods: {
|
||||
goSearch() {
|
||||
const data = {
|
||||
...this.queryParam,
|
||||
title: this.queryTitle
|
||||
}
|
||||
|
||||
this.$apiServe.getProductList(data).then(res => {
|
||||
let tags = res.data.data
|
||||
if (tags) {
|
||||
for (const item of tags) {
|
||||
let tag = item.tags
|
||||
this.tagsArray = tag.split(',')
|
||||
item.tags = this.tagsArray[0]
|
||||
}
|
||||
this.productList = tags
|
||||
}
|
||||
}).finally(_ => {})
|
||||
},
|
||||
//点击图片跳转到详情页
|
||||
toDetailPage(item) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/detail/productsDetail/productsDetail?id=' + item.id
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
177
packageSearch/search/search.vue
Normal file
@@ -0,0 +1,177 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 顶部导航栏 -->
|
||||
<view class="top-search">
|
||||
<customer-searchbar ref="search" :queryParam="queryParam" :search-bar-top="searchBarTop"
|
||||
:search-bar-height="searchBarHeight" @search="goSearch" @back="goBack" />
|
||||
</view>
|
||||
<!-- 最近搜索 -->
|
||||
<view class="recent-search" :style="{marginTop: Number(searchBarTop + searchBarHeight) + 'px',}">
|
||||
<view class="title">
|
||||
<text class="title-text">最近搜索</text>
|
||||
<u-icon name="trash" color="#666666" size="24" @click="clearRecentSearch" />
|
||||
</view>
|
||||
<view class="recent-record">
|
||||
<view v-if="recentRecordList.length > 0" class="no-empty-record">
|
||||
<view v-for="(item, index) in recentRecordList" :key="index" class="tag-item">
|
||||
<u-tag bg-color="#eee" borderColor="#eee" color="#666" :text="item"
|
||||
@click="recentSearch(item)" />
|
||||
</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<view class="empty-record">
|
||||
<text>暂无搜索记录</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 搜索发现 -->
|
||||
<view class="search-found">
|
||||
<view class="title">
|
||||
<text class="title-text">搜索发现</text>
|
||||
</view>
|
||||
<view class="found-record">
|
||||
<view v-for="(item, index) in foundList" :key="index" class="tag-item">
|
||||
<u-tag bg-color="#eee" borderColor="#eee" color="#666" :text="item.name"
|
||||
@click="recentSearch(item.name)" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
toast
|
||||
} from 'service/request.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
searchBarTop: 0, //搜索栏的外边框高度,单位px
|
||||
searchBarHeight: 0, //搜索栏的高度,单位px
|
||||
queryParam: '',
|
||||
recentRecordList: [],
|
||||
foundList: []
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getDiscover()
|
||||
const tempList = uni.getStorageSync('storage_search_record')
|
||||
this.recentRecordList = tempList ? tempList : [];
|
||||
const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
|
||||
this.searchBarTop = menuButtonInfo.top;
|
||||
this.searchBarHeight = menuButtonInfo.height;
|
||||
},
|
||||
methods: {
|
||||
goSearch(param) {
|
||||
if (!param) {
|
||||
toast.warn('请输入搜索内容')
|
||||
return
|
||||
}
|
||||
this.queryParam = param
|
||||
const index = this.recentRecordList.findIndex(item => {
|
||||
return item === param
|
||||
})
|
||||
if (index > -1) {
|
||||
this.recentRecordList.splice(index, 1)
|
||||
}
|
||||
this.recentRecordList.unshift(param)
|
||||
try {
|
||||
uni.setStorageSync('storage_search_record', this.recentRecordList);
|
||||
} catch (e) {
|
||||
// error
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: '../search-products/search-products?title=' + param
|
||||
})
|
||||
},
|
||||
goBack() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
recentSearch(obj) {
|
||||
this.queryParam = obj
|
||||
// console.log(obj)
|
||||
},
|
||||
clearRecentSearch() {
|
||||
this.recentRecordList = []
|
||||
try {
|
||||
uni.setStorageSync('storage_search_record', this.recentRecordList);
|
||||
} catch (e) {
|
||||
// error
|
||||
}
|
||||
},
|
||||
getDiscover() {
|
||||
this.$apiServe.getDiscover().then(res => {
|
||||
this.foundList = res.data.data
|
||||
}).finally(_ => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.top-search {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.recent-search {
|
||||
.title {
|
||||
padding: 32rpx 10rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.title-text {
|
||||
font-size: 32rpx;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #3E3E3E;
|
||||
line-height: 42rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.recent-record {
|
||||
.empty-record {
|
||||
font-size: 28rpx;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #666666;
|
||||
line-height: 28rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.no-empty-record {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
padding: 0 10rpx;
|
||||
|
||||
.tag-item {
|
||||
margin: 0 20rpx 20rpx 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.search-found {
|
||||
.title {
|
||||
padding: 32rpx 10rpx;
|
||||
|
||||
.title-text {
|
||||
font-size: 32rpx;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #3E3E3E;
|
||||
line-height: 42rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.found-record {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
padding: 0 10rpx;
|
||||
|
||||
.tag-item {
|
||||
margin: 0 20rpx 20rpx 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
242
pages.json
@@ -1,20 +1,250 @@
|
||||
{
|
||||
"easycom": {
|
||||
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
|
||||
"autoscan": true, //是否自动扫描组件
|
||||
"custom": {
|
||||
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue",
|
||||
"^ua-(.*)": "@/components/uview-ui/components/u-$1/u-$1.vue",
|
||||
"^customer-(.*)": "@/components/uni-$1.vue" // 匹配components目录内的vue文件
|
||||
}
|
||||
},
|
||||
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
||||
{
|
||||
"pages": [{
|
||||
"path": "pages/index/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "uni-app"
|
||||
"navigationBarTitleText": "食瞳",
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationBarBackgroundColor": "#12CA64",
|
||||
//导航栏取消
|
||||
// "navigationStyle": "custom",
|
||||
//是否开启下拉刷新
|
||||
"enablePullDownRefresh": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/report/report",
|
||||
"style": {
|
||||
"navigationBarTitleText": "行业&需求",
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationBarBackgroundColor": "#12CA64",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/ideasAndNeeds/ideasAndNeeds",
|
||||
"style": {
|
||||
"navigationBarTitleText": "创需发布",
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationBarBackgroundColor": "#12CA64",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/my/my",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的",
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationStyle": "custom",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/my/login/login",
|
||||
"style": {
|
||||
"navigationBarTitleText": "登录",
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationStyle": "custom",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/detail/productsDetail/productsDetail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "商品详情",
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationBarBackgroundColor": "#12CA64",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"subPackages": [{
|
||||
"root": "packageMy",
|
||||
"pages": [{
|
||||
"path": "bindCompany/bindCompany",
|
||||
"style": {
|
||||
"navigationBarTitleText": "绑定公司",
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationBarBackgroundColor": "#12CA64",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}, {
|
||||
"path": "browseHistory/browseHistory",
|
||||
"style": {
|
||||
"navigationBarTitleText": "浏览记录",
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationBarBackgroundColor": "#12CA64",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
}, {
|
||||
"path": "memberCenter/memberCenter",
|
||||
"style": {
|
||||
"navigationBarTitleText": "会员中心",
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationStyle": "custom",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
}, {
|
||||
"path": "myRelease/myRelease",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的发布",
|
||||
"navigationBarTextStyle": "white",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}, {
|
||||
"path": "changeAvatar/changeAvatar",
|
||||
"style": {
|
||||
"navigationBarTitleText": "修改头像",
|
||||
"navigationBarTextStyle": "white",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}, {
|
||||
"path": "myCollection/myCollection",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的收藏",
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationBarBackgroundColor": "#12CA64",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}]
|
||||
},
|
||||
{
|
||||
"root": "packageSearch",
|
||||
"pages": [{
|
||||
"path": "search/search",
|
||||
"style": {
|
||||
"navigationBarTitleText": "顶部搜索",
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationBarBackgroundColor": "#12CA64",
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "goods-category-search/category-index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "分类详情",
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationBarBackgroundColor": "#12CA64",
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}, {
|
||||
"path": "search-products/search-products",
|
||||
"style": {
|
||||
"navigationBarTitleText": "产品列表",
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationBarBackgroundColor": "#12CA64",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "packageReport",
|
||||
"pages": [{
|
||||
"path": "newsList/newsList",
|
||||
"style": {
|
||||
"navigationBarTitleText": "行内新闻",
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationBarBackgroundColor": "#12CA64",
|
||||
"enablePullDownRefresh": true
|
||||
}
|
||||
}, {
|
||||
"path": "certifiedCj/certifiedCj",
|
||||
"style": {
|
||||
"navigationBarTitleText": "认证厂家",
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationBarBackgroundColor": "#12CA64",
|
||||
"enablePullDownRefresh": true
|
||||
}
|
||||
}, {
|
||||
"path": "newsDetail/newsDetail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "行业新闻详情",
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationBarBackgroundColor": "#12CA64",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "certifiedCjDetail/certifiedCjDetail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "厂家信息",
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationBarBackgroundColor": "#12CA64",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
}, {
|
||||
"path": "newProductRelease/newProductRelease",
|
||||
"style": {
|
||||
"navigationBarTitleText": "企业需求",
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationBarBackgroundColor": "#12CA64",
|
||||
"enablePullDownRefresh": true
|
||||
}
|
||||
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"tabBar": {
|
||||
"color": "#CCCCCC",
|
||||
"selectedColor": "#0EBB5B",
|
||||
"borderStyle": "white",
|
||||
"backgroundColor": "#FFFFFF",
|
||||
"list": [{
|
||||
"pagePath": "pages/index/index",
|
||||
"text": "首页",
|
||||
"iconPath": "static/tabBar/sy_icon_syh.png",
|
||||
"selectedIconPath": "static/tabBar/sy_icon_sy(1).png"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/report/report",
|
||||
"text": "行业&需求",
|
||||
"iconPath": "static/tabBar/sy_icon_hyh.png",
|
||||
"selectedIconPath": "static/tabBar/sy_icon_sy.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/ideasAndNeeds/ideasAndNeeds",
|
||||
"text": "创需发布",
|
||||
"iconPath": "static/tabBar/sy_icon_cyh.png",
|
||||
"selectedIconPath": "static/tabBar/sy_icon_cy.png"
|
||||
},
|
||||
|
||||
{
|
||||
"pagePath": "pages/my/my",
|
||||
"text": "我的",
|
||||
"iconPath": "static/tabBar/sy_icon_wdh.png",
|
||||
"selectedIconPath": "static/tabBar/sy_icon_wd.png"
|
||||
}
|
||||
]
|
||||
},
|
||||
"globalStyle": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "uni-app",
|
||||
"navigationBarBackgroundColor": "#F8F8F8",
|
||||
"navigationBarBackgroundColor": "#12CA64",
|
||||
"backgroundColor": "#F8F8F8"
|
||||
},
|
||||
"uniIdRouter": {}
|
||||
"uniIdRouter": {},
|
||||
"condition": { //模式配置,仅开发期间生效
|
||||
"current": 0, //当前激活的模式(list 的索引项)
|
||||
"list": [{
|
||||
"name": "", //模式名称
|
||||
"path": "", //启动页面,必选
|
||||
"query": "" //启动参数,在页面的onLoad函数里面得到
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
433
pages/detail/productsDetail/productsDetail.vue
Normal file
@@ -0,0 +1,433 @@
|
||||
<template>
|
||||
<view>
|
||||
<view style="position: relative;padding-bottom: 100rpx;">
|
||||
<u-image :src="imgUrl+detailList.cover" width="750rpx" height="530rpx">
|
||||
</u-image>
|
||||
<view class="collect" v-if="detailList.is_fav==0||!detailList.is_fav" @click="starTap">
|
||||
<view class="star">
|
||||
<u-image src="/static/detail/xp_icon_wstar.png" width="28rpx" height="28rpx">
|
||||
</u-image>
|
||||
</view>
|
||||
<u-image src="/static/detail/xiangqing_icon_shoucang.png" width="119rpx" height="48rpx">
|
||||
</u-image>
|
||||
</view>
|
||||
<view class="collect" v-if="detailList.is_fav==1" @click="cancelStarTap(detailList.fav_id)">
|
||||
<view class="star">
|
||||
<u-image src="/static/detail/xp_icon_star.png" width="28rpx" height="28rpx">
|
||||
</u-image>
|
||||
</view>
|
||||
<u-image src="/static/detail/xiangqing_icon_shoucang.png" width="119rpx" height="48rpx">
|
||||
</u-image>
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="title_box">
|
||||
<text class="title">{{detailList.name}}</text>
|
||||
<view class="title_tag">{{detailList.cate_bname}}</view>
|
||||
</view>
|
||||
<view class="desc">
|
||||
<text>{{detailList.title}}</text>
|
||||
|
||||
</view>
|
||||
<view class="classify">
|
||||
{{detailList.cate_name}}
|
||||
</view>
|
||||
<view class="tag_view">
|
||||
<view style="width: 85%;">
|
||||
<text class="tagOne" v-for="item in detailList.tags" :key="item.id">{{item}}</text>
|
||||
</view>
|
||||
<!-- thumb有值,显示数字+赞 -->
|
||||
<view v-if="detailList.thumb" class="heart">
|
||||
<!-- 如果用户对该商品没有点赞,显示灰星 -->
|
||||
<u-image v-if="detailList.is_thumb==0" src="/static/detail/xp_icon_heart.png" width="34rpx"
|
||||
height="32rpx" @click="heartTap">
|
||||
</u-image>
|
||||
<!-- 如果用户对该商品已经点赞,显示黄星-->
|
||||
<u-image v-if="detailList.is_thumb==1" src="/static/detail/xp_icon_ysc.png" width="34rpx"
|
||||
height="32rpx" @click="cancelHeartTap(detailList.thumb_id)">
|
||||
</u-image>
|
||||
<text class="thumb">{{detailList.thumb}} 赞</text>
|
||||
</view>
|
||||
<!-- thumb无值,显示‘点赞’二字 ,用户进行一次点赞之后,显示1赞-->
|
||||
<view v-else class="heart">
|
||||
<view v-if="detailList.is_thumb==0" style="display: flex;">
|
||||
<u-image src="/static/detail/xp_icon_heart.png" width="34rpx" height="32rpx"
|
||||
@click="heartTap">
|
||||
</u-image>
|
||||
<text class="thumb" @click="heartTap">点赞</text>
|
||||
</view>
|
||||
<view v-if="detailList.is_thumb==1" style="display: flex;">
|
||||
<!-- 用户是否点赞字段 showHeart -->
|
||||
<u-image src="/static/detail/xp_icon_ysc.png" width="34rpx" height="32rpx"
|
||||
@click="cancelHeartTap(detailList.thumb_id)">
|
||||
</u-image>
|
||||
<text class="thumb">{{detailList.thumb}} 赞</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="releaseDate">
|
||||
<u-image src="/static/products/xp_icon_sjf.png" width="24rpx" height="24rpx">
|
||||
</u-image>
|
||||
<text class="release">发布日期:</text>
|
||||
<text>{{detailList.pub_time}}</text>
|
||||
</view>
|
||||
|
||||
<u-parse :content="detailList.desc"></u-parse>
|
||||
|
||||
<u-modal :show="showCall" closeOnClickOverlay="false" confirmText="确定" @confirm="confirmCopy">
|
||||
<rich-text :nodes="contentCopy"></rich-text>
|
||||
</u-modal>
|
||||
<view style="margin:0 20rpx;">
|
||||
<u-overlay :show="!isLoad">
|
||||
<login :timoutText="timoutText" @success="reOnLoad()" @fail="failToLoad()"></login>
|
||||
</u-overlay>
|
||||
</view>
|
||||
<u-modal :show="showUpdate" :content='content' closeOnClickOverlay="false" showCancelButton="true"
|
||||
confirmText="升级VIP" @confirm="confirm" @cancel="cancel" confirmColor="#0EBB5B">
|
||||
<rich-text :nodes="updateContent"></rich-text>
|
||||
</u-modal>
|
||||
<u-modal :show="showUpdating" closeOnClickOverlay="false" confirmText="确定" @confirm="confirm">
|
||||
<rich-text :nodes="updatingContent"></rich-text>
|
||||
</u-modal>
|
||||
</view>
|
||||
<view class="footer" @click="showContact()">
|
||||
<u-icon name="kefu-ermai" color="#fff" size="30rpx"></u-icon>
|
||||
<text>联系客服</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
dateFormatDetail
|
||||
} from '../../../utills/date.js'
|
||||
import login from 'pages/my/login/login'
|
||||
export default {
|
||||
components: {
|
||||
login
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
id: '',
|
||||
imgUrl: '',
|
||||
showHeart: false,
|
||||
detailList: [],
|
||||
isLoad: true,
|
||||
showUpdate: false,
|
||||
showUpdating: false,
|
||||
showCall: false,
|
||||
kf_email: '',
|
||||
updateContent: '您暂无权限访问,请升级VIP访问',
|
||||
updatingContent: '升级VIP,正在审核中',
|
||||
timoutText: 1,
|
||||
contentCopy: `邮箱已复制,如需联系客服,请发送邮件。`
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
this.id = option.id
|
||||
this.getProductDetail()
|
||||
this.getKfEmail()
|
||||
},
|
||||
methods: {
|
||||
//获取客服电话
|
||||
getKfEmail() {
|
||||
this.$apiServe.getKfEmail().then(res => {
|
||||
this.kf_email = res.data.data.kf_email
|
||||
}).finally(_ => {})
|
||||
},
|
||||
//获取详情信息
|
||||
getProductDetail() {
|
||||
this.$apiServe.getProductDetail(this.id).then(res => {
|
||||
console.log('产品详情', res);
|
||||
let detail = res.data.data
|
||||
let dataCode = res.data.code
|
||||
if (dataCode === -1 || res.statusCode == 500) {
|
||||
this.isLoad = false
|
||||
}
|
||||
//授权登录拦截
|
||||
if (dataCode == 0 && detail.mytpe == 1) {
|
||||
this.isLoad = false
|
||||
}
|
||||
//跳转到升级VIP页面
|
||||
if (dataCode == 0 && detail.mytpe == 2) {
|
||||
this.showUpdate = true
|
||||
}
|
||||
//升级VIP正在审核中
|
||||
if (dataCode == 0 && detail.mytpe == 3) {
|
||||
this.showUpdating = true
|
||||
}
|
||||
|
||||
if (detail) {
|
||||
detail.pub_time = dateFormatDetail(detail.pub_time)
|
||||
if (detail.tags) {
|
||||
detail.tags = detail.tags.split(',')
|
||||
}
|
||||
|
||||
// if (detail.is_thumb == 1 && parseInt(detail.thumb) == 1 && parseInt(detail
|
||||
// .thumbcount) == 1) {
|
||||
// console.log('222');
|
||||
// detail.thumb = parseInt(detail.thumbcount)
|
||||
// } else {
|
||||
detail.thumb = parseInt(detail.thumb) + parseInt(detail.thumbcount)
|
||||
// }
|
||||
|
||||
this.detailList = detail
|
||||
}
|
||||
}).finally(_ => {})
|
||||
},
|
||||
//点击star收藏
|
||||
starTap() {
|
||||
if (!uni.getStorageSync('loginToken')) {
|
||||
this.$toast.warn('请登录后操作')
|
||||
} else {
|
||||
this.$apiServe.collect(this.id).then(res => {
|
||||
if (res.data.code == 1) {
|
||||
this.$toast.warn('收藏成功')
|
||||
this.getProductDetail()
|
||||
} else {
|
||||
this.$toast.warn('收藏失败')
|
||||
}
|
||||
}).finally(_ => {})
|
||||
}
|
||||
},
|
||||
//点击star取消收藏
|
||||
cancelStarTap(fav_id) {
|
||||
this.$apiServe.deleteHistoryOrCollection(fav_id).then(res => {
|
||||
if (res.data.code == 1) {
|
||||
this.$toast.warn('取消收藏')
|
||||
this.getProductDetail()
|
||||
} else {
|
||||
this.$toast.warn('取消收藏失败')
|
||||
}
|
||||
}).finally(_ => {})
|
||||
},
|
||||
//点赞按钮
|
||||
heartTap() {
|
||||
if (!uni.getStorageSync('loginToken')) {
|
||||
this.$toast.warn('请登录后操作')
|
||||
} else {
|
||||
this.$apiServe.thumb(this.id).then(res => {
|
||||
if (res.data.code == 1) {
|
||||
this.getProductDetail()
|
||||
this.$toast.warn('点赞成功')
|
||||
} else {
|
||||
this.$toast.warn('点赞失败')
|
||||
}
|
||||
}).finally(_ => {})
|
||||
}
|
||||
},
|
||||
//取消点赞
|
||||
cancelHeartTap(thumb_id) {
|
||||
this.$apiServe.cancelThumb(thumb_id).then(res => {
|
||||
if (res.data.code == 1) {
|
||||
this.getProductDetail()
|
||||
this.$toast.warn('取消点赞')
|
||||
} else {
|
||||
this.$toast.warn('取消点赞失败')
|
||||
}
|
||||
}).finally(_ => {})
|
||||
},
|
||||
reOnLoad() {
|
||||
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
|
||||
this.$toast.warn('登录失败请重试')
|
||||
this.isLoad = false
|
||||
// uni.navigateTo({
|
||||
// url: '../../pages/my/login/login'
|
||||
// })
|
||||
return
|
||||
}
|
||||
this.isLoad = true
|
||||
this.getProductDetail()
|
||||
},
|
||||
failToLoad() {
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
},
|
||||
confirm() {
|
||||
uni.navigateTo({
|
||||
url: '../../../packageMy/memberCenter/memberCenter?ask=' + 1
|
||||
})
|
||||
},
|
||||
cancel() {
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
},
|
||||
// 联系客服模态框
|
||||
showContact() {
|
||||
uni.setClipboardData({
|
||||
data: this.kf_email, //要被复制的内容
|
||||
success: () => { //复制成功的回调函数
|
||||
wx.hideLoading();
|
||||
wx.hideToast();
|
||||
this.showCall = true
|
||||
}
|
||||
})
|
||||
},
|
||||
confirmCopy() {
|
||||
this.showCall = false
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.u-modal__content {
|
||||
padding: 43rpx 43rpx !important;
|
||||
// text-indent: 14rpx;
|
||||
}
|
||||
|
||||
.collect {
|
||||
display: flex;
|
||||
position: absolute;
|
||||
top: 16rpx;
|
||||
right: 0;
|
||||
color: #fff;
|
||||
border-radius: 54rpx 0px 0px 54rpx;
|
||||
padding: 2px 2px 2px 3px;
|
||||
|
||||
.star {
|
||||
position: absolute !important;
|
||||
top: 6px !important;
|
||||
right: 77rpx;
|
||||
z-index: 99;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 20rpx;
|
||||
background-color: #fff;
|
||||
|
||||
.title_box {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.title {
|
||||
width: 80%;
|
||||
font-size: 48rpx;
|
||||
font-weight: bold;
|
||||
color: #134b40;
|
||||
line-height: 60rpx;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.title_tag {
|
||||
height: 30rpx;
|
||||
background: #0EBB5B;
|
||||
border-radius: 7rpx;
|
||||
font-size: 26rpx;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #FFFFFF;
|
||||
line-height: 28rpx;
|
||||
padding: 1rpx 15rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.desc {
|
||||
font-size: 42rpx;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #3E3E3E;
|
||||
padding: 24rpx 0;
|
||||
overflow: hidden;
|
||||
// white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.classify {
|
||||
width: 117rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 6rpx;
|
||||
border: 1rpx solid #EEEEEE;
|
||||
font-size: 30rpx;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #666666;
|
||||
line-height: 40rpx;
|
||||
padding: 1rpx 15rpx;
|
||||
}
|
||||
|
||||
.tag_view {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-top: 24rpx;
|
||||
font-size: 30rpx;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #CCCCCC;
|
||||
// line-height: 28rpx;
|
||||
|
||||
.tagOne {
|
||||
padding-right: 20rpx;
|
||||
}
|
||||
|
||||
.heart {
|
||||
display: flex;
|
||||
|
||||
.thumb {
|
||||
font-size: 24rpx;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #666666;
|
||||
line-height: 33rpx;
|
||||
margin-left: 14rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.releaseDate {
|
||||
font-size: 30rpx;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #666666;
|
||||
line-height: 33rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 24rpx 20rpx;
|
||||
margin: 20rpx 0;
|
||||
background-color: #fff;
|
||||
|
||||
.release {
|
||||
padding: 0 10rpx 0 6rpx;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
.footer {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 100rpx;
|
||||
background: #0EBB5B;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-content: center;
|
||||
text-align: center;
|
||||
|
||||
.u-icon {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
text {
|
||||
font-size: 20rpx;
|
||||
font-family: MicrosoftYaHei-Bold, MicrosoftYaHei;
|
||||
font-weight: bold;
|
||||
color: #FFFFFF;
|
||||
line-height: 26rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
485
pages/ideasAndNeeds/ideasAndNeeds.vue
Normal file
@@ -0,0 +1,485 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<view class="top-tab">
|
||||
<u-tabs :list="tabsList" :scrollable="false" lineWidth="25" lineColor="#0A994A" color="#969696"
|
||||
:activeStyle="{color: '#15CA65', fontWeight: '400', transform: 'scale(1.05)', size:'20rpx'}"
|
||||
lineHeight="4" :current="tabCurrent" @change="tabChange"></u-tabs>
|
||||
</view>
|
||||
<u--form :model="needsPublishForm" ref="uNeedsForm" :labelStyle="formLabelStyle">
|
||||
<view style="margin-bottom: 20rpx;">
|
||||
<u-form-item label="姓名" borderBottom>
|
||||
<u-input v-model="needsPublishForm.name" :border="false" placeholder="请输入您的名称"
|
||||
placeholder-style="color:#CCCCCC" :disabled="btnDisabled" disabledColor="#ffffff" />
|
||||
</u-form-item>
|
||||
<u-form-item label="城市">
|
||||
<view class="select-view" @tap="btnDisabled==true?showCityPicker=false:showCityPicker = true">
|
||||
<text v-if="needsPublishForm.area_name">{{needsPublishForm.area_name}}</text>
|
||||
<text v-else style="color:#CCCCCC;">请选择所在城市</text>
|
||||
<u-icon name="arrow-right" color="#969696" size="14"></u-icon>
|
||||
</view>
|
||||
<cityPicker :show-picker="showCityPicker" @cancel="showCityPicker = false" @confirm="getCityValue">
|
||||
</cityPicker>
|
||||
</u-form-item>
|
||||
</view>
|
||||
|
||||
<view style="margin-bottom: 20rpx;">
|
||||
<view v-if="tabCurrent === 1">
|
||||
<u-form-item label="品名" borderBottom>
|
||||
<u-input v-model="needsPublishForm.pname" :border="false" placeholder="请输入您的产品名称"
|
||||
placeholder-style="color:#CCCCCC" :disabled="btnDisabled" disabledColor="#ffffff" />
|
||||
</u-form-item>
|
||||
<u-form-item label="分类" borderBottom>
|
||||
<view class="select-view"
|
||||
@tap="btnDisabled==true?showCategoryPicker=false: showCategoryPicker=true">
|
||||
<text v-if="needsPublishForm.class">{{needsPublishForm.class}}</text>
|
||||
<text v-else style="color:#CCCCCC;">请选择分类</text>
|
||||
<u-icon name="arrow-right" color="#969696" size="14"></u-icon>
|
||||
</view>
|
||||
<u-picker :show="showCategoryPicker" :columns="categoryPickerList"
|
||||
@cancel="showCategoryPicker = false" @confirm="getCategoryValue">
|
||||
</u-picker>
|
||||
</u-form-item>
|
||||
</view>
|
||||
<u-form-item label="产品" borderBottom>
|
||||
<view class="select-view"
|
||||
@tap="btnDisabled==true?showProductPicker=false: showProductPicker = true">
|
||||
<text v-if="needsPublishForm.product">{{needsPublishForm.product}}</text>
|
||||
<text v-else style="color:#CCCCCC;">请选择产品类型</text>
|
||||
<u-icon name="arrow-right" color="#969696" size="14"></u-icon>
|
||||
</view>
|
||||
<u-picker :show="showProductPicker" :columns="productPickerColumn"
|
||||
@cancel="showProductPicker = false" @confirm="getProductValue">
|
||||
</u-picker>
|
||||
</u-form-item>
|
||||
<u-form-item label="定位" borderBottom>
|
||||
<view class="select-view"
|
||||
@tap="btnDisabled==true?showPositionPicker=false:showPositionPicker = true">
|
||||
<text v-if="needsPublishForm.loc">{{needsPublishForm.loc}}</text>
|
||||
<text v-else style="color:#CCCCCC;">请选择产品定位</text>
|
||||
<u-icon name="arrow-right" color="#969696" size="14"></u-icon>
|
||||
</view>
|
||||
<u-picker :show=showPositionPicker :columns="positionPickerColumn"
|
||||
@cancel="showPositionPicker = false" @confirm="getPositionValue">
|
||||
</u-picker>
|
||||
</u-form-item>
|
||||
<view style="padding: 20rpx 15rpx;background-color: #fff;">
|
||||
<u-textarea v-model="needsPublishForm.desc" border="surround" placeholder="请输入具体描述(限120字)"
|
||||
:maxlength="120" placeholder-style="color:#CCCCCC" :disabled="btnDisabled"
|
||||
disabledColor="#ffffff"></u-textarea>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="tabCurrent === 1" style="margin-bottom: 20rpx;">
|
||||
<u-form-item label="上传图片" labelPosition="top">
|
||||
<view style="padding-left: 20rpx;margin-top: 20rpx;">
|
||||
<u-upload :fileList="fileList1" :auto-upload="false" @afterRead="afterRead" @delete="deletePic"
|
||||
name="1" multiple :maxCount="10" :disabled="btnDisabled"></u-upload>
|
||||
</view>
|
||||
</u-form-item>
|
||||
</view>
|
||||
|
||||
<view style="background-color: #fff;">
|
||||
<u-form-item v-if="false" label="联系方式" borderBottom>
|
||||
<u-radio-group v-model="needsPublishForm.contactWay" placement="row">
|
||||
<u-radio :customStyle="{marginRight: '16px'}" label="手机" name="mobile" :disabled="btnDisabled">
|
||||
</u-radio>
|
||||
<u-radio label="邮箱" name="email" :disabled="btnDisabled">
|
||||
</u-radio>
|
||||
</u-radio-group>
|
||||
</u-form-item>
|
||||
<u-form-item label="手机" borderBottom>
|
||||
<u--input placeholder="请输入手机号" :border="false" v-model="needsPublishForm.mobile"
|
||||
placeholder-style="color:#CCCCCC" :disabled="btnDisabled" disabledColor="#ffffff"></u--input>
|
||||
</u-form-item>
|
||||
<u-form-item label="邮箱" borderBottom>
|
||||
<u--input placeholder="请输入邮箱地址" :border="false" v-model="needsPublishForm.email"
|
||||
:disabled="btnDisabled" placeholder-style="color:#CCCCCC"></u--input>
|
||||
</u-form-item>
|
||||
<view style="padding: 6rpx 20rpx 0;text-align: left;background-color: #fff;">
|
||||
<text
|
||||
style="font-size: 24rpx;font-family: PingFangSC-Regular, PingFang SC;font-weight: 400;color: #C8C8C8;line-height: 28rpx;">
|
||||
联系方式将不对外发布。如有相关意向,平台会以您留下的联系方式通知您。
|
||||
</text>
|
||||
</view>
|
||||
<!-- <u-form-item label="验证" borderBottom>
|
||||
<view style="display: flex;padding-right: 20rpx;align-items: center;">
|
||||
<u--input placeholder="请输入验证码" :border="false" v-model="needsPublishForm.invalidCode"
|
||||
placeholder-style="color:#CCCCCC"></u--input>
|
||||
<u-code ref="uCode" @change="codeChange" keep-running change-text="倒计时XS"
|
||||
@start="disabled = true" @end="disabled = false"></u-code>
|
||||
<u-button size="small" type="primary" @tap="getCode" :text="tips" color="#EEEEEE"
|
||||
:disabled="disabled" customStyle="color:#666666; width:160rpx;"></u-button>
|
||||
</view>
|
||||
</u-form-item> -->
|
||||
<view style="padding: 30rpx;background-color: #fff;">
|
||||
<u-button color="#0EBB5B" text="确定发布" @tap.stop="submitForm" :disabled="btnDisabled"></u-button>
|
||||
</view>
|
||||
<view style="padding: 12rpx 30rpx 20rpx 30rpx;background-color: #fff;">
|
||||
<text
|
||||
style="font-size: 24rpx;font-family: PingFangSC-Regular, PingFang SC;font-weight: 400;color: #C8C8C8;line-height: 28rpx;"
|
||||
v-if="tabCurrent === 0">{{claim_r}}</text>
|
||||
<text
|
||||
style="font-size: 24rpx;font-family: PingFangSC-Regular, PingFang SC;font-weight: 400;color: #C8C8C8;line-height: 28rpx;"
|
||||
v-if="tabCurrent === 1">{{claim_c}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</u--form>
|
||||
<view style="margin:0 20rpx;">
|
||||
<u-overlay :show="!isLoad">
|
||||
<login @success="reOnLoad()" @fail="failToLoad()"></login>
|
||||
</u-overlay>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
apiService
|
||||
} from '../../service/request'
|
||||
import login from '../my/login/login.vue'
|
||||
export default {
|
||||
components: {
|
||||
login
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
btnDisabled: false,
|
||||
claim_r: '',
|
||||
claim_c: '',
|
||||
tabsList: [{
|
||||
name: '需求发布'
|
||||
}, {
|
||||
name: '创意发布'
|
||||
}],
|
||||
tabCurrent: 0,
|
||||
needsPublishForm: {},
|
||||
formLabelStyle: {
|
||||
'font-size': '32rpx !important'
|
||||
},
|
||||
showCityPicker: false,
|
||||
showProductPicker: false,
|
||||
showPositionPicker: false,
|
||||
showCategoryPicker: false,
|
||||
seconds: 10,
|
||||
disabled: false,
|
||||
tips: '获取验证码',
|
||||
productPickerList: [],
|
||||
productPickerColumn: [
|
||||
[]
|
||||
],
|
||||
positionPickerList: [],
|
||||
positionPickerColumn: [
|
||||
[]
|
||||
],
|
||||
categoryPickerList: [],
|
||||
fileList1: [],
|
||||
isLoad: true,
|
||||
cateName: null,
|
||||
tagName: null,
|
||||
token: null,
|
||||
imgUrl: null
|
||||
}
|
||||
},
|
||||
onTabItemTap() {
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
|
||||
this.isLoad = false
|
||||
return
|
||||
}
|
||||
this.isLoad = true
|
||||
this.token = uni.getStorageSync('loginToken')
|
||||
this.tabCurrent = 0
|
||||
this.fileList1 = []
|
||||
this.needsPublishForm = {}
|
||||
},
|
||||
onLoad(options) {
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
//我的发布点击修改回显数据
|
||||
if (options && options.item && uni.getStorageSync(options.item)) {
|
||||
try {
|
||||
let publishFormList = uni.getStorageSync(options.item)
|
||||
this.fileList1 = publishFormList.images.map(item => {
|
||||
return {
|
||||
url: item
|
||||
}
|
||||
})
|
||||
this.needsPublishForm = publishFormList
|
||||
} catch (error) {
|
||||
this.$toast.warn(error)
|
||||
}
|
||||
}
|
||||
if (options.index == 0) {
|
||||
this.tabCurrent = 0
|
||||
} else if (options.index == 1) {
|
||||
this.tabCurrent = 1
|
||||
}
|
||||
if (options.view == 11) {
|
||||
this.btnDisabled = true
|
||||
}
|
||||
// this.getProductPickerList()
|
||||
},
|
||||
onShow() {
|
||||
this.getFormData()
|
||||
},
|
||||
methods: {
|
||||
tabChange(data) {
|
||||
this.tabCurrent = data.index
|
||||
this.needsPublishForm = {}
|
||||
this.fileList1 = []
|
||||
this.btnDisabled = this.btnDisabled == true ? false : false;
|
||||
},
|
||||
getFormData() {
|
||||
this.$apiServe.getIdeasAndNeedsFormdata().then(res => {
|
||||
const formData = res.data.data
|
||||
this.productPickerColumn[0] = formData.product
|
||||
this.positionPickerColumn[0] = formData.loc
|
||||
this.categoryPickerList[0] = formData.class
|
||||
this.claim_r = formData.claim_r
|
||||
this.claim_c = formData.claim_c
|
||||
// this.productPickerList = res.data.data.map((item, index) => {
|
||||
// temp.push(item.name)
|
||||
// return item
|
||||
// })
|
||||
// this.productPickerColumn[0] = [...temp]
|
||||
}).finally(_ => {})
|
||||
},
|
||||
// getProductPickerList() {
|
||||
// const data = {}
|
||||
// const temp = []
|
||||
// this.$apiServe.getCategories(data).then(res => {
|
||||
// this.productPickerList = res.data.data.map((item, index) => {
|
||||
// temp.push(item.name)
|
||||
// return item
|
||||
// })
|
||||
// // this.productPickerColumn[0] = [...temp]
|
||||
// }).finally(_ => {})
|
||||
// },
|
||||
// getPositionPickerList() {
|
||||
// if (this.needsPublishForm.cate_id) {
|
||||
// const data = {
|
||||
// pid: this.needsPublishForm.cate_id
|
||||
// }
|
||||
// this.$apiServe.getTags(data).then(res => {
|
||||
// const temp = []
|
||||
// this.positionPickerList = res.data.data.map((item, index) => {
|
||||
// temp.push(item.name)
|
||||
// return item
|
||||
// })
|
||||
// this.positionPickerColumn[0] = temp
|
||||
// }).finally(_ => {})
|
||||
// } else {
|
||||
// that.$toast.warn('请先选择产品类型')
|
||||
// }
|
||||
// },
|
||||
getCityValue(data) {
|
||||
this.showCityPicker = false
|
||||
this.needsPublishForm.area_name = data[0].join('-')
|
||||
this.needsPublishForm.area_code = data[1]
|
||||
},
|
||||
getProductValue(data) {
|
||||
this.showProductPicker = false
|
||||
this.showCategoryPicker = false
|
||||
this.needsPublishForm.product = data.value[0]
|
||||
// const obj = this.productPickerList.find(item => {
|
||||
// return item.name === data.value[0]
|
||||
// })
|
||||
// this.cateName = data.value[0]
|
||||
// if (obj) {
|
||||
// this.needsPublishForm.cate_id = obj.id
|
||||
// }
|
||||
// this.needsPublishForm.tagids = null
|
||||
// this.getPositionPickerList()
|
||||
},
|
||||
getPositionValue(data) {
|
||||
this.showPositionPicker = false
|
||||
this.needsPublishForm.loc = data.value[0]
|
||||
// const obj = this.positionPickerList.find(item => {
|
||||
// return item.name === data.value[0]
|
||||
// })
|
||||
// this.tagName = data.value[0]
|
||||
// if (obj) {
|
||||
// this.needsPublishForm.tagids = obj.id
|
||||
// }
|
||||
},
|
||||
getCategoryValue(data) {
|
||||
this.showCategoryPicker = false
|
||||
this.needsPublishForm.class = data.value[0]
|
||||
},
|
||||
getCode() {
|
||||
if (this.$refs.uCode.canGetCode) {
|
||||
// 模拟向后端请求验证码
|
||||
uni.showLoading({
|
||||
title: '正在获取验证码'
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
// 这里此提示会被this.start()方法中的提示覆盖
|
||||
uni.$u.toast('验证码已发送');
|
||||
// 通知验证码组件内部开始倒计时
|
||||
this.$refs.uCode.start();
|
||||
}, 2000);
|
||||
} else {
|
||||
uni.$u.toast('倒计时结束后再发送');
|
||||
}
|
||||
},
|
||||
codeChange(text) {
|
||||
this.tips = text;
|
||||
},
|
||||
// 删除图片
|
||||
deletePic(event) {
|
||||
this[`fileList${event.name}`].splice(event.index, 1)
|
||||
},
|
||||
// 新增图片
|
||||
async afterRead(event) {
|
||||
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
|
||||
let lists = [].concat(event.file)
|
||||
let fileListLen = this[`fileList${event.name}`].length
|
||||
lists.map((item) => {
|
||||
this[`fileList${event.name}`].push({
|
||||
...item,
|
||||
status: 'uploading',
|
||||
message: '上传中'
|
||||
})
|
||||
})
|
||||
for (let i = 0; i < lists.length; i++) {
|
||||
const result = await this.uploadFilePromise(lists[i].url)
|
||||
let item = this[`fileList${event.name}`][fileListLen]
|
||||
this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
|
||||
status: 'success',
|
||||
message: '',
|
||||
url: result
|
||||
}))
|
||||
fileListLen++
|
||||
}
|
||||
},
|
||||
uploadFilePromise(url) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let a = uni.uploadFile({
|
||||
url: apiService.uploadImgUrl,
|
||||
filePath: url,
|
||||
name: 'file',
|
||||
header: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
"token": this.token
|
||||
},
|
||||
success: (res) => {
|
||||
setTimeout(() => {
|
||||
resolve(JSON.parse(res.data).data.url)
|
||||
}, 1000)
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
submitForm() {
|
||||
if (!this.needsPublishForm.mobile && !this.needsPublishForm.email) {
|
||||
this.$toast.warn('请输入正确的手机号或者正确的邮箱地址')
|
||||
return false
|
||||
}
|
||||
if (this.tabCurrent === 1 && this.fileList1.length < 1) {
|
||||
this.$toast.warn('请至少上传一张图片')
|
||||
return false
|
||||
}
|
||||
if (this.needsPublishForm.mobile && !/^1[3456789]\d{9}$/.test(this.needsPublishForm.mobile)) {
|
||||
this.$toast.warn('请输入正确的手机号')
|
||||
return false
|
||||
} else if (this.needsPublishForm.email && !/^([0-9a-zA-Z_\.\-\])+\@([0-9a-zA-Z_\.\-\])+\.([a-zA-Z]+)$/
|
||||
.test(this.needsPublishForm.email)) {
|
||||
this.$toast.warn('请输入正确的邮箱地址')
|
||||
return false
|
||||
}
|
||||
this.needsPublishForm.type = Number(this.tabCurrent + 1)
|
||||
this.needsPublishForm.pub_time = this.needsPublishForm.pub_time ? this.needsPublishForm.pub_time :
|
||||
Math.round(new Date().getTime() / 1000)
|
||||
const temp = []
|
||||
if (this.fileList1.length > 0) {
|
||||
this.fileList1.map(item => {
|
||||
const url = item.url
|
||||
temp.push(url.replace(this.imgUrl + '/', ''))
|
||||
})
|
||||
}
|
||||
this.needsPublishForm.images = temp.join(';')
|
||||
const data = {
|
||||
type: null,
|
||||
name: null,
|
||||
pname: null,
|
||||
area_code: null,
|
||||
area_name: null,
|
||||
images: null,
|
||||
mobile: null,
|
||||
email: null,
|
||||
class: null,
|
||||
product: null,
|
||||
loc: null,
|
||||
desc: null,
|
||||
pub_time: null,
|
||||
...this.needsPublishForm
|
||||
}
|
||||
apiService.submitIdeasAndNeeds(data).then(res => {
|
||||
if (res.data.code === 1) {
|
||||
this.$toast.success('提交成功')
|
||||
// if (this.needsPublishForm.id) {
|
||||
uni.navigateTo({
|
||||
url: '../../packageMy/myRelease/myRelease?index=' + (this.tabCurrent + 1)
|
||||
})
|
||||
// }
|
||||
this.tabCurrent = 0
|
||||
this.fileList1 = []
|
||||
this.needsPublishForm = {}
|
||||
} else {
|
||||
this.$toast.warn(res.data.msg)
|
||||
}
|
||||
// this.$toast.success(res.data.msg)
|
||||
}).catch(error => {
|
||||
this.$toast.warn(error)
|
||||
})
|
||||
},
|
||||
failToLoad() {
|
||||
this.$toast.warn('登录失败请重试')
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
/deep/.u-textarea--disabled {
|
||||
background-color: #ffffff !important;
|
||||
}
|
||||
|
||||
/deep/.u-input {
|
||||
background-color: #ffffff !important;
|
||||
}
|
||||
|
||||
.content {
|
||||
background-color: #F8F8F8;
|
||||
|
||||
.top-tab {
|
||||
background-color: #fff;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.select-view {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 14rpx 18rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
/deep/.u-form-item__body__left__content__label {
|
||||
font-size: 32rpx !important;
|
||||
}
|
||||
|
||||
/deep/.u-form-item__body {
|
||||
padding: 13rpx 0 !important;
|
||||
}
|
||||
|
||||
/deep/.u-textarea {
|
||||
border-radius: 20rpx;
|
||||
border: 1px solid #EEEEEE;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,45 +1,267 @@
|
||||
<!-- 首页 -->
|
||||
<template>
|
||||
<view class="wrap">
|
||||
<u-swiper :list="list" keyName="image" showTitle :autoplay="false" circular />
|
||||
<view>
|
||||
<!-- 搜索框 -->
|
||||
<view class="search_box">
|
||||
<view class="search_box_border">
|
||||
<u-input placeholder="搜索优质产品" placeholder-style="color: #969696" prefixIcon="search"
|
||||
prefixIconStyle="font-size: 22px;color: #909399;margin-left:30rpx" readonly @tap="toSearch()">
|
||||
</u-input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="content">
|
||||
<!-- 分类模块 -->
|
||||
<view class="classify">
|
||||
<u-grid :border="false" col="5">
|
||||
<u-grid-item v-for="(listItem,listIndex) in classifyList" :key="listIndex"
|
||||
@click="toClassify(listItem.id)">
|
||||
<u--image :src="imgUrl+listItem.icon" width="86rpx" height="86rpx" :lazy-load="true">
|
||||
</u--image>
|
||||
<!-- <u-icon size="86rpx" :name="listItem.icon"></u-icon> -->
|
||||
<text class="grid-text">{{listItem.name}}</text>
|
||||
</u-grid-item>
|
||||
</u-grid>
|
||||
</view>
|
||||
<!-- 分类模块下的轮播图 -->
|
||||
<view>
|
||||
<u-swiper :list="swiperList" keyName="img" indicatorMode="line" radius="0" circular
|
||||
@change="e => currentNum = e.current"
|
||||
@click="handleSwiperList(currentNum==''?0:currentNum,swiperList)"></u-swiper>
|
||||
</view>
|
||||
|
||||
<!-- 选项卡: 上架时间和点赞量 -->
|
||||
<view>
|
||||
<u-tabs :list="tabList" lineColor="#15CA65" scrollable="false"
|
||||
activeStyle="color:#15CA65;font-weight: bold;" :current="tabCurrent" @change="tabChange">
|
||||
</u-tabs>
|
||||
</view>
|
||||
<!-- 产品 -->
|
||||
<productsByTime v-if="tabCurrent==0 && initStart" ref="productsByTime" @getTimeLength="getTimeLength">
|
||||
</productsByTime>
|
||||
<productsByThumb v-if="tabCurrent==1 && initStart" ref="productsByThumb" @getThumbLength="getThumbLength">
|
||||
</productsByThumb>
|
||||
<view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;"
|
||||
v-show="reachBottomLength===0">
|
||||
没有更多数据了</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {apiService} from '../../service/request.js'
|
||||
import {
|
||||
serverHost
|
||||
} from '@/service/request.js'
|
||||
export default {
|
||||
computed: {},
|
||||
data() {
|
||||
return {
|
||||
list: [{
|
||||
image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
|
||||
title: '昨夜星辰昨夜风,画楼西畔桂堂东'
|
||||
classifyList: [],
|
||||
tabCurrent: 0,
|
||||
tabList: [{
|
||||
name: '新品发布' // 上架时间(改)
|
||||
},
|
||||
{
|
||||
image: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
|
||||
title: '身无彩凤双飞翼,心有灵犀一点通'
|
||||
name: '企业需求' // 点赞量(改)
|
||||
},
|
||||
{
|
||||
image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
|
||||
title: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳'
|
||||
}
|
||||
],
|
||||
imgUrl: '',
|
||||
initStart: false,
|
||||
swiperList: [],
|
||||
reachBottomLength: '',
|
||||
currentNum: ''
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
console.log('--------------')
|
||||
apiService.getCategories().then(res => {
|
||||
const {message} = res.data
|
||||
console.log(message)
|
||||
})
|
||||
onReachBottom() {
|
||||
if (this.tabCurrent == 0 && this.reachBottomLength !== 0) {
|
||||
this.$refs.productsByTime.pageNum++
|
||||
this.$refs.productsByTime.getProductsByTime()
|
||||
}
|
||||
if (this.tabCurrent == 1 && this.reachBottomLength !== 0) {
|
||||
this.$refs.productsByThumb.pageNum++
|
||||
this.$refs.productsByThumb.getProductsByThumb()
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getImgUrl()
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
this.getCategories()
|
||||
this.getBanner()
|
||||
wx.showShareMenu({
|
||||
withShareTicket: true,
|
||||
//设置下方的Menus菜单,才能够让发送给朋友与分享到朋友圈两个按钮可以点击
|
||||
menus: ["shareAppMessage", "shareTimeline"]
|
||||
})
|
||||
},
|
||||
//分享到微信好友
|
||||
onShareAppMessage(res) {
|
||||
return {
|
||||
title: '食瞳',
|
||||
type: 0,
|
||||
path: '/pages/index/index?id=' + distSource,
|
||||
summary: "",
|
||||
imageUrl: "https://pupil.hchyun.com/uploads/product/zhanwei02.png"
|
||||
}
|
||||
},
|
||||
//分享到朋友圈
|
||||
onShareTimeline(res) {
|
||||
return {
|
||||
title: '食瞳',
|
||||
type: 0,
|
||||
query: 'id=' + distSource,
|
||||
summary: "",
|
||||
imageUrl: "https://pupil.hchyun.com/uploads/product/zhanwei02.png"
|
||||
}
|
||||
},
|
||||
|
||||
//获取按上架时间排列的产品列表length
|
||||
getTimeLength(e) {
|
||||
this.reachBottomLength = e
|
||||
},
|
||||
//获取按点赞量排列的产品列表length
|
||||
getThumbLength(e) {
|
||||
this.reachBottomLength = e
|
||||
},
|
||||
//点击上架时间和点赞量切换页面
|
||||
tabChange(data) {
|
||||
this.tabCurrent = data.index
|
||||
if (data.index == 0) {
|
||||
this.$refs.productsByTime.getProductsByTime()
|
||||
} else if (data.index == 1) {
|
||||
this.$refs.productsByThumb.getProductsByThumb()
|
||||
}
|
||||
},
|
||||
//获取一级分类
|
||||
getCategories() {
|
||||
this.$apiServe.getCategories().then(res => {
|
||||
this.classifyList = res.data.data
|
||||
}).finally(_ => {})
|
||||
},
|
||||
//获取首页轮播图
|
||||
getBanner() {
|
||||
this.$apiServe.getBanner().then(res => {
|
||||
|
||||
let banner = res.data.data
|
||||
console.log('轮播图', banner);
|
||||
if (banner) {
|
||||
for (const item of banner) {
|
||||
item.img = this.imgUrl + item.img
|
||||
}
|
||||
this.swiperList = res.data.data
|
||||
}
|
||||
}).finally(_ => {})
|
||||
},
|
||||
//点击轮播图
|
||||
handleSwiperList(currentNum, swiperList) {
|
||||
swiperList[currentNum].link = swiperList[currentNum].link.replace(/\s*/g, "")
|
||||
uni.navigateTo({
|
||||
url: '/' + swiperList[currentNum].link
|
||||
})
|
||||
},
|
||||
//点击搜索框跳转到搜索页面
|
||||
toSearch() {
|
||||
uni.navigateTo({
|
||||
url: '../../packageSearch/search/search'
|
||||
})
|
||||
},
|
||||
//点击一级分类跳转到分类页
|
||||
toClassify(id) {
|
||||
uni.navigateTo({
|
||||
url: '../../packageSearch/goods-category-search/category-index?categoryId=' + id
|
||||
})
|
||||
},
|
||||
//获取图片url
|
||||
getImgUrl() {
|
||||
this.$apiServe.getImgUrl().then(res => {
|
||||
res.data.data.img_url = res.data.data.img_url + '/'
|
||||
try {
|
||||
uni.setStorageSync('img_url', res.data.data.img_url);
|
||||
this.initStart = true
|
||||
this.init()
|
||||
} catch (e) {
|
||||
// error
|
||||
}
|
||||
}).finally(_ => {
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
// 搜索框样式
|
||||
.search_box {
|
||||
background: linear-gradient(135deg, #12CA64 0%, #1ACA67 100%);
|
||||
|
||||
.search_box_border {
|
||||
width: 94.6%;
|
||||
height: 124rpx;
|
||||
background: linear-gradient(320deg, #36E182 0%, #26DD76 100%, #26DD76 100%);
|
||||
margin: 0 auto;
|
||||
box-shadow: 0 -1px 3px 0 #31B96D;
|
||||
border-radius: 38rpx 38rpx 0 0;
|
||||
|
||||
.u-border {
|
||||
border: none;
|
||||
padding-top: 16px !important;
|
||||
|
||||
.u-input__content {
|
||||
height: 64rpx;
|
||||
border-radius: 32rpx;
|
||||
background-color: #fff;
|
||||
|
||||
.u-input__content__field-wrapper__field {
|
||||
font-size: 26rpx !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
|
||||
//分类模块
|
||||
.classify {
|
||||
height: 350rpx;
|
||||
background: #FFFFFF;
|
||||
border-radius: 24rpx;
|
||||
|
||||
box-shadow: 0px 2px 4px 0px rgba(206, 206, 206, 0.5);
|
||||
|
||||
.u-grid {
|
||||
padding-top: 30rpx;
|
||||
|
||||
.grid-text {
|
||||
padding-top: 8rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.u-grid-item {
|
||||
padding-bottom: 38rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//轮播图
|
||||
.u-swiper__wrapper__item__wrapper {
|
||||
margin-top: 20rpx;
|
||||
height: 290rpx;
|
||||
}
|
||||
|
||||
.u-swiper-indicator__wrapper {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
// 选项卡
|
||||
.u-tabs__wrapper__nav {
|
||||
background-color: #FFFFFF;
|
||||
|
||||
.u-tabs__wrapper__nav__item {
|
||||
padding: 0 !important;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
<style lang='scss' scoped>
|
||||
.wrap {
|
||||
padding: 40rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
127
pages/my/login/login.vue
Normal file
@@ -0,0 +1,127 @@
|
||||
<template>
|
||||
<view class="login-content">
|
||||
<view style="text-align: center;margin-bottom:30rpx;">
|
||||
<text>{{loginText}}</text>
|
||||
</view>
|
||||
<view style="padding-left: 30rpx;padding-right: 30rpx;display: flex;">
|
||||
<u-button type="info" :plain="true" size="nomal" @click="$emit('fail')">取消</u-button>
|
||||
<u-button open-type="getPhoneNumber" size="nomal" @getphonenumber="getphonenumber" color='#12CA64'>登录
|
||||
</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
apiService,
|
||||
loginSys
|
||||
} from '@/service/request.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loginText: '请登录后查看'
|
||||
}
|
||||
},
|
||||
props: {
|
||||
timoutText: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.timoutText == 1) {
|
||||
this.loginText = "登录超时,请重新登录"
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getphonenumber(e) {
|
||||
var that = this
|
||||
console.log(e)
|
||||
if (e.detail.errMsg === 'getPhoneNumber:ok') {
|
||||
//调用接口利用 e.detail.encryptedData, e.detail.iv 信息来解密手机号
|
||||
uni.login({
|
||||
"provider": "weixin",
|
||||
"onlyAuthorize": true, // 微信登录仅请求授权认证
|
||||
success: function(event) {
|
||||
const {
|
||||
code
|
||||
} = event
|
||||
that.$apiServe.login({
|
||||
code: code
|
||||
}).then(res => {
|
||||
var data = res.data.data
|
||||
// console.log('登录code换取的信息', data);
|
||||
uni.setStorageSync('loginToken', data.token);
|
||||
that.$toast.success('登录成功')
|
||||
that.$emit('success')
|
||||
//登录完成后使用手机code换取手机号,调用/user/getMobileByMnp接口
|
||||
//接口详细链接 https://docs.apipost.cn/preview/468be606f65cae75/3f2f988ddf82dd8e
|
||||
const codeData = {
|
||||
code: e.detail.code
|
||||
}
|
||||
apiService.postMobileByMnp(codeData).then(res => {
|
||||
console.log(res)
|
||||
})
|
||||
})
|
||||
},
|
||||
fail: function(err) {
|
||||
// 登录授权失败
|
||||
// err.code是错误码
|
||||
that.$emit('fail')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// 拒绝授权
|
||||
that.$emit('fail')
|
||||
}
|
||||
}
|
||||
// getphonenumber(e) {
|
||||
// const {
|
||||
// phoneCode
|
||||
// } = e.detail;
|
||||
// console.log("手机code : ", phoneCode);
|
||||
// uni.login({
|
||||
// "provider": "weixin",
|
||||
// "onlyAuthorize": true, // 微信登录仅请求授权认证
|
||||
// success: function(event) {
|
||||
// const {
|
||||
// code
|
||||
// } = event
|
||||
|
||||
// console.log("登录code", code);
|
||||
// //客户端成功获取授权临时票据(code),向业务服务器发起登录请求。
|
||||
|
||||
|
||||
// // 调用登录接口 拿到token 传手机code,更新手机号码
|
||||
// loginSys(code).then(res => {
|
||||
// console.log(res);
|
||||
|
||||
// //登录完成后使用手机code换取手机号,调用/user/getMobileByMnp接口
|
||||
// //接口详细链接 https://docs.apipost.cn/preview/468be606f65cae75/3f2f988ddf82dd8e
|
||||
// })
|
||||
// },
|
||||
// fail: function(err) {
|
||||
// // 登录授权失败
|
||||
// // err.code是错误码
|
||||
// }
|
||||
// })
|
||||
// },
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
/deep/.u-button {
|
||||
width: 40% !important;
|
||||
}
|
||||
|
||||
.login-content {
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
padding: 50rpx 30rpx;
|
||||
background-color: #fff;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
</style>
|
||||
200
pages/my/my.vue
Normal file
@@ -0,0 +1,200 @@
|
||||
<!-- 个人中心 -->
|
||||
<template>
|
||||
<view>
|
||||
<u-navbar :autoBack="false" title="我的"></u-navbar>
|
||||
<u--image src="/static/my/wo_icon_bj1.png" width="750rpx" height="349rpx">
|
||||
</u--image>
|
||||
<myAvatar ref="myavatar"></myAvatar>
|
||||
<view class="table">
|
||||
<u-cell-group>
|
||||
<!-- <u-cell v-if="is_bind" size="large" title="绑定公司" icon="/static/my/wo_icon_bd.png" :isLink="true"
|
||||
value="已绑定公司">
|
||||
</u-cell> -->
|
||||
<!-- <u-cell v-else size="large" title="绑定公司" icon="/static/my/wo_icon_bd.png" :isLink="true" value="未绑定公司"
|
||||
@click="bindCompany()">
|
||||
</u-cell> -->
|
||||
<u-cell size="large" title="会员中心" icon="/static/my/wo_icon_hyzx.png" :isLink="true"
|
||||
@click="toMemberCenter()"></u-cell>
|
||||
<u-cell size="large" title="浏览记录" icon="/static/my/wo_icon_lljl.png" :isLink="true"
|
||||
@click="toBrowseHistory()"></u-cell>
|
||||
<u-cell size="large" title="我的收藏" icon="/static/my/wo_icon_sc.png" :isLink="true"
|
||||
@click="toMyCollect()"></u-cell>
|
||||
<u-cell size="large" title="我的发布" icon="/static/my/wo_icon_wdfb.png" :isLink="true"
|
||||
@click="toMyRelease()"></u-cell>
|
||||
<u-cell size="large" title="联系客服" icon="/static/my/wo_icon_lxkf.png" :isLink="true"
|
||||
@click="showModal()">
|
||||
</u-cell>
|
||||
</u-cell-group>
|
||||
<u-modal :show="showM" showCancelButton closeOnClickOverlay="false" confirmText="是" cancelText="否"
|
||||
@confirm="confirm" @cancel="cancel">
|
||||
<view>
|
||||
<view>{{mobile}}</view>
|
||||
<text>是否拨打客服电话</text>
|
||||
</view>
|
||||
</u-modal>
|
||||
</view>
|
||||
<view style="margin:0 20rpx;">
|
||||
<u-overlay :show="!isLoad">
|
||||
<login @success="reOnLoad()" @fail="failToLoad()"></login>
|
||||
</u-overlay>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import login from 'pages/my/login/login'
|
||||
export default {
|
||||
components: {
|
||||
login
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showM: false,
|
||||
mobile: '',
|
||||
isLoad: true,
|
||||
is_bind: false
|
||||
}
|
||||
},
|
||||
onTabItemTap() {
|
||||
this.$refs.myavatar.getUser()
|
||||
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
|
||||
this.isLoad = false
|
||||
return
|
||||
}
|
||||
this.isLoad = true
|
||||
},
|
||||
onLoad() {
|
||||
if (uni.getStorageSync('com_mobile')) {
|
||||
this.is_bind = true
|
||||
}
|
||||
this.getCsTel()
|
||||
},
|
||||
methods: {
|
||||
//获取客服电话
|
||||
getCsTel() {
|
||||
this.$apiServe.getCsTel().then(res => {
|
||||
if (res.data.data) {
|
||||
this.mobile = res.data.data.cs_tel
|
||||
}
|
||||
}).finally(_ => {})
|
||||
},
|
||||
//跳转到绑定公司页面
|
||||
bindCompany() {
|
||||
uni.navigateTo({
|
||||
url: '../../packageMy/bindCompany/bindCompany'
|
||||
})
|
||||
},
|
||||
//跳转到会员中心页面
|
||||
toMemberCenter() {
|
||||
uni.navigateTo({
|
||||
url: '../../packageMy/memberCenter/memberCenter'
|
||||
})
|
||||
},
|
||||
//跳转到浏览记录页面
|
||||
toBrowseHistory() {
|
||||
uni.navigateTo({
|
||||
url: '../../packageMy/browseHistory/browseHistory'
|
||||
})
|
||||
},
|
||||
//跳转到我的收藏页面
|
||||
toMyCollect() {
|
||||
uni.navigateTo({
|
||||
url: '../../packageMy/myCollection/myCollection'
|
||||
})
|
||||
},
|
||||
//跳转到我的发布页面
|
||||
toMyRelease() {
|
||||
uni.navigateTo({
|
||||
url: '../../packageMy/myRelease/myRelease'
|
||||
})
|
||||
},
|
||||
// 联系客服模态框
|
||||
showModal() {
|
||||
this.showM = true
|
||||
},
|
||||
confirm() {
|
||||
this.showM = false
|
||||
let phone = this.mobile
|
||||
phone = phone.toString()
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: phone,
|
||||
success: function() {
|
||||
console.log('拨打电话成功');
|
||||
},
|
||||
fail() {
|
||||
console.log('打电话失败了');
|
||||
}
|
||||
})
|
||||
},
|
||||
cancel() {
|
||||
this.showM = false
|
||||
},
|
||||
reOnLoad() {
|
||||
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
|
||||
this.$toast.warn('登录失败请重试')
|
||||
this.isLoad = false
|
||||
return
|
||||
}
|
||||
this.isLoad = true
|
||||
if (this.isLoad) {
|
||||
this.$refs.myavatar.getUser()
|
||||
}
|
||||
},
|
||||
failToLoad() {
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.u-navbar__content__left {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
background-color: #fff;
|
||||
margin-top: 50rpx;
|
||||
}
|
||||
|
||||
.u-line {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.u-cell--clickable {
|
||||
background-color: #fff !important;
|
||||
}
|
||||
|
||||
.u-cell {
|
||||
border-bottom: 1rpx solid #EEEEEE;
|
||||
|
||||
}
|
||||
|
||||
.u-cell:last-child {
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
.u-icon__icon--info {
|
||||
font-size: 28rpx !important;
|
||||
}
|
||||
|
||||
.u-cell__title-text {
|
||||
margin-left: 20rpx;
|
||||
font-size: 26rpx !important;
|
||||
color: #252421;
|
||||
line-height: 33rpx !important;
|
||||
}
|
||||
|
||||
.u-cell__value {
|
||||
font-size: 26rpx !important;
|
||||
color: #CCCCCC !important;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.u-modal__content {
|
||||
padding: 43rpx 104rpx !important;
|
||||
text-indent: 25rpx;
|
||||
}
|
||||
</style>
|
||||
180
pages/report/report.vue
Normal file
@@ -0,0 +1,180 @@
|
||||
<template>
|
||||
<view style="padding-bottom: 50rpx;">
|
||||
<!-- classify -->
|
||||
<view class="classify">
|
||||
<u-grid :border="false" col="3">
|
||||
<u-grid-item v-for="(listItem,listIndex) in classifyList" :key="listIndex" @click="click(listIndex)">
|
||||
<u--image :src="listItem.src" width="86rpx" height="86rpx" :lazy-load="true">
|
||||
</u--image>
|
||||
<text class="grid-text">{{listItem.title}}</text>
|
||||
</u-grid-item>
|
||||
</u-grid>
|
||||
</view>
|
||||
|
||||
<!-- 行业新闻 -->
|
||||
<view>
|
||||
<view class="subtitle">
|
||||
<u--image src="/static/report/hy_icon_xwx.png" width="24rpx" height="24rpx" :lazy-load="true">
|
||||
</u--image>
|
||||
<text class="xw_text text">行业新闻</text>
|
||||
</view>
|
||||
<news></news>
|
||||
</view>
|
||||
|
||||
<!-- 企业需求 -->
|
||||
<view>
|
||||
<view class="subtitle">
|
||||
<u--image src="/static/report/hy_icon_fux.png" width="24rpx" height="24rpx" :lazy-load="true">
|
||||
</u--image>
|
||||
<text class="xpfb_text text">企业需求</text>
|
||||
</view>
|
||||
<productsByThumb></productsByThumb>
|
||||
</view>
|
||||
|
||||
<!-- 认证厂家 -->
|
||||
<view v-if="token==true">
|
||||
<view class="subtitle">
|
||||
<u--image src="/static/report/hy_icon_cjx.png" width="24rpx" height="24rpx" :lazy-load="true">
|
||||
</u--image>
|
||||
<text class="rzcj_text text">认证厂家</text>
|
||||
</view>
|
||||
<certifiedCj></certifiedCj>
|
||||
</view>
|
||||
<view style="margin:0 20rpx;">
|
||||
<u-overlay :show="!isLoad">
|
||||
<login @success="reOnLoad()" @fail="failToLoad()"></login>
|
||||
</u-overlay>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import login from 'pages/my/login/login'
|
||||
export default {
|
||||
components: {
|
||||
login
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isLoad: true,
|
||||
token: '',
|
||||
classifyList: [{
|
||||
src: '/static/report/hy_icon_xw.png',
|
||||
title: '行业新闻'
|
||||
},
|
||||
{
|
||||
src: '/static/report/hy_icon_fu.png',
|
||||
title: '企业需求'
|
||||
},
|
||||
{
|
||||
src: '/static/report/hy_icon_cj.png',
|
||||
title: '认证厂家'
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
if (uni.getStorageSync('loginToken')) {
|
||||
this.token = true
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
if (uni.getStorageSync('loginToken')) {
|
||||
this.token = true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
//点击一级分类
|
||||
click(listIndex) {
|
||||
//点击行内新闻时
|
||||
if (listIndex == 0) {
|
||||
uni.navigateTo({
|
||||
url: '../../packageReport/newsList/newsList'
|
||||
})
|
||||
} else if (listIndex == 1) {
|
||||
uni.navigateTo({
|
||||
url: '../../packageReport/newProductRelease/newProductRelease'
|
||||
})
|
||||
} else if (listIndex == 2) {
|
||||
if (uni.getStorageSync('loginToken')) {
|
||||
uni.navigateTo({
|
||||
url: '../../packageReport/certifiedCj/certifiedCj'
|
||||
})
|
||||
} else {
|
||||
this.isLoad = false
|
||||
}
|
||||
}
|
||||
},
|
||||
reOnLoad() {
|
||||
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
|
||||
this.$toast.warn('登录失败请重试')
|
||||
this.isLoad = false
|
||||
return
|
||||
}
|
||||
this.isLoad = true
|
||||
if (this.isLoad) {
|
||||
uni.navigateTo({
|
||||
url: '../../packageReport/certifiedCj/certifiedCj'
|
||||
})
|
||||
}
|
||||
},
|
||||
failToLoad() {
|
||||
uni.reLaunch({
|
||||
url: '/pages/report/report'
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
//分类模块
|
||||
.classify {
|
||||
background: #FFFFFF;
|
||||
border-radius: 0 0 24rpx 24rpx;
|
||||
box-shadow: 0px 2px 4px 0px rgba(206, 206, 206, 0.5);
|
||||
padding-bottom: 30rpx;
|
||||
margin: 0 16rpx;
|
||||
|
||||
.u-grid {
|
||||
padding-top: 22rpx;
|
||||
|
||||
.grid-text {
|
||||
padding-top: 8rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
margin: 24rpx 0 16rpx 16rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.text {
|
||||
font-size: 28rpx;
|
||||
font-family: PingFangSC-Medium, PingFang SC;
|
||||
font-weight: 500;
|
||||
line-height: 40rpx;
|
||||
padding-left: 4rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.xw_text {
|
||||
color: #5ACCF0;
|
||||
}
|
||||
|
||||
.u-image__error {
|
||||
position: static !important;
|
||||
}
|
||||
|
||||
|
||||
.xpfb_text {
|
||||
color: #FCAC18;
|
||||
}
|
||||
|
||||
.rzcj_text {
|
||||
color: #78E13A;
|
||||
}
|
||||
</style>
|
||||
@@ -1,221 +1,461 @@
|
||||
|
||||
const serverHost = 'https://api-ugo-web.itheima.net'
|
||||
const serverHost = 'https://www.foodtops.cn/api' // https://api-ugo-web.itheima.net'
|
||||
function isOutTime(res) {
|
||||
if (res.data.message === '请先登录') {
|
||||
uni.showToast('登录信息已过期,请重新登录')
|
||||
setTimeout(() => {
|
||||
uni.redirectTo({
|
||||
url: '/pages/login/login'
|
||||
})
|
||||
}, 1000)
|
||||
uni.removeStorageSync('userInfo')
|
||||
uni.removeStorageSync('token')
|
||||
} else {
|
||||
// uni.showToast(res.data.message);
|
||||
}
|
||||
if (res.data.message === '请先登录') {
|
||||
uni.showToast('登录信息已过期,请重新登录')
|
||||
setTimeout(() => {
|
||||
uni.redirectTo({
|
||||
url: '/pages/login/login'
|
||||
})
|
||||
}, 1000)
|
||||
uni.removeStorageSync('userInfo')
|
||||
uni.removeStorageSync('token')
|
||||
} else {
|
||||
// uni.showToast(res.data.message);
|
||||
}
|
||||
}
|
||||
|
||||
const service = {
|
||||
get(url) {
|
||||
const header = {}
|
||||
header['Authorization'] = 'Bearer ' + uni.getStorageSync('token')
|
||||
header['content-type'] = 'application/json'
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
method: 'get',
|
||||
url: serverHost + url,
|
||||
header: header,
|
||||
success: res => {
|
||||
// // 调用接口成功
|
||||
// if (!res.data.data) {
|
||||
// isOutTime(res)
|
||||
// reject(res)
|
||||
// }
|
||||
resolve(res)
|
||||
},
|
||||
fail: err => {
|
||||
// 调用接口失败
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
post(url, data, isLogin) {
|
||||
const header = {}
|
||||
if (isLogin) {
|
||||
// header['content-type'] = 'application/x-www-form-urlencoded';
|
||||
console.log(isLogin)
|
||||
header['Authorization'] = ''
|
||||
} else {
|
||||
header['Authorization'] = 'Bearer ' + uni.getStorageSync('token')
|
||||
header['content-type'] = 'application/json'
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
method: 'post',
|
||||
url: serverHost + url,
|
||||
data: data,
|
||||
header: header,
|
||||
timeout: 30000,
|
||||
success: res => {
|
||||
console.log(1111, res)
|
||||
uni.hideLoading()
|
||||
// if (res.data.exception === 'UnAuthorizedException') {
|
||||
// let pages = getCurrentPages()
|
||||
// let page = (pages[pages.length - 1]).route
|
||||
// if (!page.includes('login')) {
|
||||
// uni.navigateTo({
|
||||
// url: `/pages/login/login`
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// if (res.data.message) {
|
||||
// isOutTime(res);
|
||||
// toast.error(res.data.message)
|
||||
// reject(res);
|
||||
// }
|
||||
|
||||
// if (isLogin && !res.data.access_token) {
|
||||
// reject(res);
|
||||
// } else {
|
||||
// resolve(res);
|
||||
// }
|
||||
resolve(res)
|
||||
},
|
||||
fail: err => {
|
||||
console.log('err', err)
|
||||
uni.hideLoading()
|
||||
// 调用接口失败
|
||||
try {
|
||||
toast.error(err.data.message)
|
||||
} catch (errr) {
|
||||
toast.error('服务器出错')
|
||||
}
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
put(url, data, isLogin) {
|
||||
const header = {}
|
||||
|
||||
if (isLogin) {
|
||||
header['content-type'] = 'application/x-www-form-urlencoded'
|
||||
} else {
|
||||
header['Authorization'] = 'Bearer ' + uni.getStorageSync('token')
|
||||
header['content-type'] = 'application/json'
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
method: 'put',
|
||||
url: serverHost + url,
|
||||
header: header,
|
||||
success: res => {
|
||||
if (!res.data.flag) {
|
||||
isOutTime(res)
|
||||
reject(res)
|
||||
}
|
||||
|
||||
resolve(res)
|
||||
},
|
||||
data: data,
|
||||
fail: err => {
|
||||
// 调用接口失败
|
||||
// toast.error(res.data.message)
|
||||
uni.hideLoading()
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
get(url, data) {
|
||||
const header = {}
|
||||
// header['Authorization'] = 'Bearer ' + uni.getStorageSync('token')
|
||||
header['token'] = uni.getStorageSync('loginToken')
|
||||
header['content-type'] = 'application/json'
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
method: 'get',
|
||||
url: serverHost + url,
|
||||
data: data,
|
||||
header: header,
|
||||
success: res => {
|
||||
// // 调用接口成功
|
||||
// if (!res.data.data) {
|
||||
// isOutTime(res)
|
||||
// reject(res)
|
||||
// }
|
||||
resolve(res)
|
||||
},
|
||||
fail: err => {
|
||||
// 调用接口失败
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
post(url, data, isLogin) {
|
||||
const header = {}
|
||||
header['token'] = uni.getStorageSync('loginToken')
|
||||
header['content-type'] = 'application/json'
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
method: 'post',
|
||||
url: serverHost + url,
|
||||
data: data,
|
||||
header: header,
|
||||
timeout: 30000,
|
||||
success: res => {
|
||||
uni.hideLoading()
|
||||
// if (res.data.exception === 'UnAuthorizedException') {
|
||||
// let pages = getCurrentPages()
|
||||
// let page = (pages[pages.length - 1]).route
|
||||
// if (!page.includes('login')) {
|
||||
// uni.navigateTo({
|
||||
// url: `/pages/login/login`
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// if (res.data.message) {
|
||||
// isOutTime(res);
|
||||
// toast.error(res.data.message)
|
||||
// reject(res);
|
||||
// }
|
||||
|
||||
// if (isLogin && !res.data.access_token) {
|
||||
// reject(res);
|
||||
// } else {
|
||||
// resolve(res);
|
||||
// }
|
||||
resolve(res)
|
||||
},
|
||||
fail: err => {
|
||||
console.log('err', err)
|
||||
uni.hideLoading()
|
||||
// 调用接口失败
|
||||
try {
|
||||
toast.error(err.data.message)
|
||||
} catch (errr) {
|
||||
toast.error('服务器出错')
|
||||
}
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
put(url, data, isLogin) {
|
||||
const header = {}
|
||||
header['token'] = uni.getStorageSync('loginToken')
|
||||
header['content-type'] = 'application/json'
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
method: 'put',
|
||||
url: serverHost + url,
|
||||
header: header,
|
||||
success: res => {
|
||||
// if (!res.data.flag) {
|
||||
// isOutTime(res)
|
||||
// reject(res)
|
||||
// }
|
||||
resolve(res)
|
||||
},
|
||||
data: data,
|
||||
fail: err => {
|
||||
// 调用接口失败
|
||||
// toast.error(res.data.message)
|
||||
uni.hideLoading()
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
putWithFormData(url, data, isLogin) {
|
||||
const header = {}
|
||||
header['token'] = uni.getStorageSync('loginToken')
|
||||
header['content-type'] = 'application/x-www-form-urlencoded'
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
method: 'put',
|
||||
url: serverHost + url,
|
||||
header: header,
|
||||
success: res => {
|
||||
// if (!res.data.flag) {
|
||||
// isOutTime(res)
|
||||
// reject(res)
|
||||
// }
|
||||
resolve(res)
|
||||
},
|
||||
data: data,
|
||||
fail: err => {
|
||||
// 调用接口失败
|
||||
// toast.error(res.data.message)
|
||||
uni.hideLoading()
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
delete(url, data, isLogin) {
|
||||
const header = {}
|
||||
header['token'] = uni.getStorageSync('loginToken')
|
||||
header['content-type'] = 'application/json'
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
method: 'delete',
|
||||
url: serverHost + url,
|
||||
data: data,
|
||||
header: header,
|
||||
success: res => {
|
||||
resolve(res)
|
||||
},
|
||||
fail: err => {
|
||||
// 调用接口失败
|
||||
// toast.error(res.data.message)
|
||||
uni.hideLoading()
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
const toastDuration = 1500
|
||||
const toast = {
|
||||
// duration: 1500,
|
||||
success: (text, dur) => {
|
||||
// $wuxToptips().success({
|
||||
// hidden: false,
|
||||
// text: text || '成功',
|
||||
// duration: dur || toastDuration
|
||||
// });
|
||||
uni.showToast({
|
||||
title: text || '成功',
|
||||
duration: dur || toastDuration
|
||||
})
|
||||
},
|
||||
warn: text => {
|
||||
// $wuxToptips().warn({
|
||||
// hidden: false,
|
||||
// text: text || '未知警告',
|
||||
// duration: toastDuration
|
||||
// });
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: text || '未知警告',
|
||||
duration: toastDuration
|
||||
})
|
||||
},
|
||||
error: text => {
|
||||
// $wuxToptips().error({
|
||||
// hidden: false,
|
||||
// text: text || '未知错误',
|
||||
// duration: toastDuration
|
||||
// });
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: text || '未知错误',
|
||||
duration: toastDuration
|
||||
})
|
||||
}
|
||||
// duration: 1500,
|
||||
success: (text, dur) => {
|
||||
// $wuxToptips().success({
|
||||
// hidden: false,
|
||||
// text: text || '成功',
|
||||
// duration: dur || toastDuration
|
||||
// });
|
||||
uni.showToast({
|
||||
title: text || '成功',
|
||||
duration: dur || toastDuration
|
||||
})
|
||||
},
|
||||
warn: text => {
|
||||
// $wuxToptips().warn({
|
||||
// hidden: false,
|
||||
// text: text || '未知警告',
|
||||
// duration: toastDuration
|
||||
// });
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: text || '未知警告',
|
||||
duration: toastDuration
|
||||
})
|
||||
},
|
||||
error: text => {
|
||||
// $wuxToptips().error({
|
||||
// hidden: false,
|
||||
// text: text || '未知错误',
|
||||
// duration: toastDuration
|
||||
// });
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: text || '未知错误',
|
||||
duration: toastDuration
|
||||
})
|
||||
}
|
||||
}
|
||||
const apiService = {
|
||||
uploadImgUrl: serverHost,
|
||||
imgUrl: serverHost,
|
||||
login: data => {
|
||||
data = Object.assign(data || {}, {})
|
||||
const url = `/api`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.post(url, data, true))
|
||||
})
|
||||
},
|
||||
// 获取
|
||||
getCategories(data) {
|
||||
const url = `/api/public/v1/categories`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.get(url, data))
|
||||
})
|
||||
},
|
||||
// 新增
|
||||
addOutboundOrder(data) {
|
||||
const url = `/api`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.post(url, data))
|
||||
})
|
||||
},
|
||||
// 提交
|
||||
deliveryOrderConfirm(data) {
|
||||
const url = `/api`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.post(url, data))
|
||||
})
|
||||
},
|
||||
// 解密
|
||||
decrypt(data) {
|
||||
const url = `/api`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.post(url, { data }))
|
||||
})
|
||||
},
|
||||
// 国密sm4加密
|
||||
sm4Encrypt(data) {
|
||||
const url = `/api`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.sm(url, data))
|
||||
})
|
||||
}
|
||||
uploadImgUrl: serverHost + `/upload/image/`,
|
||||
imgUrl: serverHost,
|
||||
// login: data => {
|
||||
// data = Object.assign(data || {}, {})
|
||||
// const url = `/api`
|
||||
// return new Promise((resolve, reject) => {
|
||||
// resolve(service.post(url, data, true))
|
||||
// })
|
||||
// },
|
||||
//登录接口
|
||||
login(data) {
|
||||
const url = `/login/mnpLogin`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.post(url, data))
|
||||
})
|
||||
},
|
||||
// 获取首页轮播图
|
||||
getBanner(data) {
|
||||
const url = `/home/banner`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.get(url, data))
|
||||
})
|
||||
},
|
||||
// 获取产品列表
|
||||
getProducts(data) {
|
||||
const url = `/home/product`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.get(url, data))
|
||||
})
|
||||
},
|
||||
// 获取产品详情
|
||||
getProductDetail(id) {
|
||||
const url = `/home/pdetail/?productId=${id}`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.get(url, id))
|
||||
})
|
||||
},
|
||||
// 获取行业新闻
|
||||
getNews(data) {
|
||||
const url = `/news/nlists`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.get(url, data))
|
||||
})
|
||||
},
|
||||
// 获取行业新闻详情
|
||||
getNewsDetail(id) {
|
||||
const url = `/news/ndetail?newsId=${id}`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.get(url, id))
|
||||
})
|
||||
},
|
||||
// 获取认证厂家列表
|
||||
getCertifiedCj(data) {
|
||||
const url = `/news/flists`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.get(url, data))
|
||||
})
|
||||
},
|
||||
// 获取认证厂家详情
|
||||
getCertifiedCjDetail(id) {
|
||||
const url = `/news/fdetail?fId=${id}`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.get(url, id))
|
||||
})
|
||||
},
|
||||
//绑定公司和升级VIP
|
||||
bindComponyAndUpdate(data) {
|
||||
const url = `/center/update`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.post(url, data))
|
||||
})
|
||||
},
|
||||
//获取历史记录或收藏
|
||||
getHistoryOrCollection(type) {
|
||||
const url = `/center/favlist/?type=${type}`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.get(url, type))
|
||||
})
|
||||
},
|
||||
//删除历史记录或收藏
|
||||
deleteHistoryOrCollection(id) {
|
||||
const url = `/center/delfav/?id=${id}`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.post(url, id))
|
||||
})
|
||||
},
|
||||
//获取创意发布&需求发布
|
||||
getIdeasAndNeeds(type) {
|
||||
const url = `/center/rlist?type=${type}`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.get(url, type))
|
||||
})
|
||||
},
|
||||
//删除创意发布&需求发布
|
||||
deleteIdeasAndNeeds(id) {
|
||||
const url = `/center/delreq/?id=${id}`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.delete(url, id))
|
||||
})
|
||||
},
|
||||
//收藏按钮
|
||||
collect(pid) {
|
||||
const url = `/center/addfav/?pid=${pid}`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.post(url, pid))
|
||||
})
|
||||
},
|
||||
//点赞按钮
|
||||
thumb(pid) {
|
||||
const url = `/center/thumb/?pid=${pid}`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.post(url, pid))
|
||||
})
|
||||
},
|
||||
//取消(清除)点赞
|
||||
cancelThumb(id) {
|
||||
const url = `/center/thumbcls/?id=${id}`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.post(url, id))
|
||||
})
|
||||
},
|
||||
//获取个人信息
|
||||
getUser() {
|
||||
const url = `/center/userinfo`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.get(url))
|
||||
})
|
||||
},
|
||||
//修改个人信息
|
||||
updateUser(data) {
|
||||
const url = `/center/userupdate`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.post(url, data))
|
||||
})
|
||||
},
|
||||
// 获取客服电话
|
||||
getCsTel() {
|
||||
const url = `/center/cfg?key=cs_tel`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.get(url))
|
||||
})
|
||||
},
|
||||
// 获取客服邮箱
|
||||
getKfEmail() {
|
||||
const url = `/center/cfg?key=kf_email`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.get(url))
|
||||
})
|
||||
},
|
||||
// 获取首页分类Tag
|
||||
getTags(data) {
|
||||
const url = `/home/tags`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.get(url, data))
|
||||
})
|
||||
},
|
||||
// 获取首页分类
|
||||
getCategories(data) {
|
||||
const url = `/home/classlist`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.get(url, data))
|
||||
})
|
||||
},
|
||||
// 获取首页分类
|
||||
getProductsByCateId(data) {
|
||||
const url = `/home/plist`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.get(url, data))
|
||||
})
|
||||
},
|
||||
// 搜索发现 热搜
|
||||
getDiscover() {
|
||||
const url = `/home/discover`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.get(url))
|
||||
})
|
||||
},
|
||||
// 搜索产品
|
||||
getProductList(data) {
|
||||
const url = `/home/product`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.get(url, data))
|
||||
})
|
||||
},
|
||||
// 图片基本地址
|
||||
getImgUrl() {
|
||||
const url = `/center/cfg?key=img_url`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.get(url))
|
||||
})
|
||||
},
|
||||
// 新增
|
||||
addOutboundOrder(data) {
|
||||
const url = `/api`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.post(url, data))
|
||||
})
|
||||
},
|
||||
// 提交
|
||||
deliveryOrderConfirm(data) {
|
||||
const url = `/api`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.post(url, data))
|
||||
})
|
||||
},
|
||||
// 提交
|
||||
submitIdeasAndNeeds(data) {
|
||||
let url = `/require/release/`
|
||||
if (data.id) {
|
||||
url = `/require/update/`
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.putWithFormData(url, data))
|
||||
})
|
||||
},
|
||||
getIdeasAndNeedsFormdata(data) {
|
||||
const url = `/require/formdata/`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.post(url, data))
|
||||
})
|
||||
},
|
||||
postMobileByMnp(data) {
|
||||
const url = `/user/getMobileByMnp`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.post(url, data))
|
||||
})
|
||||
},
|
||||
postImage(data) {
|
||||
const url = `/upload/image/`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.post(url, data))
|
||||
})
|
||||
},
|
||||
// 解密
|
||||
decrypt(data) {
|
||||
const url = `/api`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.post(url, {
|
||||
data
|
||||
}))
|
||||
})
|
||||
},
|
||||
// 国密sm4加密
|
||||
sm4Encrypt(data) {
|
||||
const url = `/api`
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(service.sm(url, data))
|
||||
})
|
||||
}
|
||||
}
|
||||
export {
|
||||
apiService,
|
||||
toast
|
||||
}
|
||||
export { apiService, toast }
|
||||
|
||||
BIN
static/category/fl_icon_qb.png
Normal file
|
After Width: | Height: | Size: 348 B |
BIN
static/category/fl_icon_xl.png
Normal file
|
After Width: | Height: | Size: 295 B |
BIN
static/classify/sy_icon_cy.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
BIN
static/classify/sy_icon_gs.png
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
BIN
static/classify/sy_icon_hp.png
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
static/classify/sy_icon_hz.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
static/classify/sy_icon_ls.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
BIN
static/classify/sy_icon_np.png
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
BIN
static/classify/sy_icon_rs.png
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
static/classify/sy_icon_sj.png
Normal file
|
After Width: | Height: | Size: 7.2 KiB |
BIN
static/classify/sy_icon_tw.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
static/classify/sy_icon_yp.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
BIN
static/detail/cj_bg.png
Normal file
|
After Width: | Height: | Size: 127 KiB |
BIN
static/detail/xiangqing_icon_shoucang.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
static/detail/xp_icon_heart.png
Normal file
|
After Width: | Height: | Size: 905 B |
BIN
static/detail/xp_icon_star.png
Normal file
|
After Width: | Height: | Size: 693 B |
BIN
static/detail/xp_icon_wstar.png
Normal file
|
After Width: | Height: | Size: 594 B |
BIN
static/detail/xp_icon_ysc.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
static/detail/zhanwei_xppx.png
Normal file
|
After Width: | Height: | Size: 221 KiB |
BIN
static/logo.png
|
Before Width: | Height: | Size: 3.9 KiB |
BIN
static/my/sdfb_icon_xg.png
Normal file
|
After Width: | Height: | Size: 773 B |
BIN
static/my/wd_icon_bj.png
Normal file
|
After Width: | Height: | Size: 574 B |
BIN
static/my/wo_icon_bd.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
static/my/wo_icon_bj1.png
Normal file
|
After Width: | Height: | Size: 90 KiB |
BIN
static/my/wo_icon_hyzx.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
static/my/wo_icon_hyzxbj.png
Normal file
|
After Width: | Height: | Size: 89 KiB |
BIN
static/my/wo_icon_lljl.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
static/my/wo_icon_lxkf.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
static/my/wo_icon_pthy.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
static/my/wo_icon_sc.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
static/my/wo_icon_vip.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
static/my/wo_icon_wdfb.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
static/products/sy_bb.png
Normal file
|
After Width: | Height: | Size: 8.5 KiB |
BIN
static/products/xp_icon_sjf.png
Normal file
|
After Width: | Height: | Size: 460 B |
BIN
static/products/zhanwei_dg.png
Normal file
|
After Width: | Height: | Size: 271 KiB |
BIN
static/report/hy_icon_cj.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
BIN
static/report/hy_icon_cjx.png
Normal file
|
After Width: | Height: | Size: 847 B |
BIN
static/report/hy_icon_fu.png
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
static/report/hy_icon_fux.png
Normal file
|
After Width: | Height: | Size: 764 B |
BIN
static/report/hy_icon_xw.png
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
BIN
static/report/hy_icon_xwx.png
Normal file
|
After Width: | Height: | Size: 478 B |
BIN
static/report/zhanwei_xf(1).png
Normal file
|
After Width: | Height: | Size: 26 KiB |