diff --git a/components/certifiedCj/certifiedCj.vue b/components/certifiedCj/certifiedCj.vue index 6adf96e..d2df719 100644 --- a/components/certifiedCj/certifiedCj.vue +++ b/components/certifiedCj/certifiedCj.vue @@ -27,13 +27,16 @@ } }, created() { - this.getCertifiedCj() this.imgUrl = uni.getStorageSync('img_url') + this.getCertifiedCj() }, methods: { // 获取认证厂家列表 getCertifiedCj() { - this.$apiServe.getCertifiedCj().then(res => { + this.$apiServe.getCertifiedCj({ + pageSize: 2, + pageNum: 1 + }).then(res => { // console.log('认证厂家', res.data.data) this.cjsList = res.data.data }).finally(_ => {}) diff --git a/components/myAvatar/myAvatar.vue b/components/myAvatar/myAvatar.vue index 3e488e0..46926b9 100644 --- a/components/myAvatar/myAvatar.vue +++ b/components/myAvatar/myAvatar.vue @@ -4,20 +4,20 @@ - + - + - {{nickname}} + {{nickname}} - + @@ -38,13 +38,14 @@ }, data() { return { - member: false, + member: '', showEdit: true, avatar: '', nickname: '用户', normal: '/static/my/wo_icon_pthy.png', VIP: '/static/my/wo_icon_vip.png', isLoad: true, + timoutText: 1 }; }, created() { @@ -66,40 +67,39 @@ //获取头像昵称和普通会员和VIP会员 getUser() { this.$apiServe.getUser().then(res => { - console.log('个人信息==', res.data); - if (res.data.msg == "登录超时,请重新登录") { - if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) { - this.$toast.warn('登录失败请重试') - this.isLoad = false - // uni.navigateTo({ - // url: '../../pages/my/login/login' - // }) - return - } + // if (res.data.msg === "登录超时,请重新登录") { + // this.isLoad = false + // } + if (res.data.code === -1) { + this.isLoad = false } var data = res.data.data - this.avatar = data.avatar - this.nickname = data.nickname - this.member = data.member + 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 - // uni.navigateTo({ - // url: '../../pages/my/login/login' - // }) return } this.isLoad = true - this.$refs.myavatar.getUser() + this.getUser() }, failToLoad() { - // uni.navigateBack({ - // url: '/pages/my/my' - // }) - this.$toast.warn('登录失败请重试') + uni.navigateBack({ + url: '/pages/index/index' + }) } } } diff --git a/components/myForm/myForm.vue b/components/myForm/myForm.vue index 9525f90..4550eb0 100644 --- a/components/myForm/myForm.vue +++ b/components/myForm/myForm.vue @@ -3,11 +3,11 @@ + placeholderStyle="color: #CCCCCC;font-size: 24rpx;" :disabled="disabled"> + placeholderStyle="color: #CCCCCC;font-size: 24rpx;" :disabled="disabled"> @@ -19,6 +19,7 @@ name: "myForm", data() { return { + disabled: false, model: { userInfo: { name: '', @@ -27,12 +28,20 @@ }, }; }, + 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') + // } } } - diff --git a/components/news/news.vue b/components/news/news.vue index f7b78c9..3766bb7 100644 --- a/components/news/news.vue +++ b/components/news/news.vue @@ -32,19 +32,25 @@ } }, created() { - this.getNews() this.imgUrl = uni.getStorageSync('img_url') + this.getNews() }, methods: { getNews() { - this.$apiServe.getNews().then(res => { - // console.log('行业新闻', res.data.data) + this.$apiServe.getNews({ + pageSize: 3, + pageNum: 1 + }).then(res => { let newsData = res.data.data - for (const item of newsData) { - item.pub_time_str = dateFormat(item.pub_time_str) + 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 } - newsData = newsData.slice(0, 3) - this.newsList = newsData + }).finally(_ => {}) }, // 跳转到新闻详情页 diff --git a/components/productsBtn/productsBtn.vue b/components/productsBtn/productsBtn.vue index 4a37ac8..a320e44 100644 --- a/components/productsBtn/productsBtn.vue +++ b/components/productsBtn/productsBtn.vue @@ -2,23 +2,23 @@ - + - + {{item.cate_name}} - + {{item.name}} - {{item.desc}} + {{item.title}} 暂无更多浏览记录 - @@ -57,9 +56,7 @@ imgUrl: '', tagsArray: [], productList: [], - // showM: false, - content: '您确定移除吗?', - productList: [] + content: '您确定移除吗?' } }, props: { @@ -69,22 +66,26 @@ styleIsolation: 'shared', // 解除样式隔离 }, created() { - this.getHistoryOrCollection() this.imgUrl = uni.getStorageSync('img_url') + this.getHistoryOrCollection() }, methods: { //获取历史记录 getHistoryOrCollection() { this.$apiServe.getHistoryOrCollection(this.type).then(res => { let data = res.data.data - for (const item of data) { - let tag = item.tags - this.tagsArray = tag.split(',') - item.tags = this.tagsArray[0] - item.create_time = dateFormatHistory(item.create_time) + 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 } - console.log('获取历史记录', data); - this.productList = data }).finally(_ => { }) @@ -132,7 +133,7 @@ //点击图片跳转到详情页 toDetailPage(item) { uni.navigateTo({ - url: '/pages/detail/productsDetail/productsDetail?id=' + item.id + url: '/pages/detail/productsDetail/productsDetail?id=' + item.product_id }) } } diff --git a/components/productsByThumb/productsByThumb.vue b/components/productsByThumb/productsByThumb.vue index 5d92239..55a323a 100644 --- a/components/productsByThumb/productsByThumb.vue +++ b/components/productsByThumb/productsByThumb.vue @@ -11,7 +11,7 @@ {{item.cate_name}} - + {{item.name}} @@ -53,8 +53,8 @@ // this.sortType = 2 // } // }) - this.getProductsByThumb() this.imgUrl = uni.getStorageSync('img_url') + this.getProductsByThumb() }, methods: { //获取按点赞量排列的产品列表 @@ -64,6 +64,7 @@ pageSize: this.pageSize, pageNum: this.pageNum }).then(res => { + console.log('产品列表2', res.data); let tags = res.data.data for (const item of tags) { let tag = item.tags diff --git a/components/productsByTime/productsByTime.vue b/components/productsByTime/productsByTime.vue index 827eaea..4f66a44 100644 --- a/components/productsByTime/productsByTime.vue +++ b/components/productsByTime/productsByTime.vue @@ -11,7 +11,7 @@ {{item.cate_name}} - + {{item.name}} @@ -38,7 +38,7 @@ export default { data() { return { - imgUrl: '', + imgUrl: null, tagsArray: [], productList: [], pageNum: 1, // 当前页 @@ -47,15 +47,8 @@ } }, created() { - // uni.$on("getCurrent", data => { - // if (data == 0) { - // this.sortType = 1 - // } else if (data == 1) { - // this.sortType = 2 - // } - // }) - this.getProductsByTime() this.imgUrl = uni.getStorageSync('img_url') + this.getProductsByTime() }, methods: { //获取按上架时间排列的产品列表 @@ -65,17 +58,21 @@ pageSize: this.pageSize, pageNum: this.pageNum }).then(res => { + console.log('产品列表1', res.data); let tags = res.data.data - for (const item of tags) { - let tag = item.tags - this.tagsArray = tag.split(',') - item.tags = this.tagsArray[0] + 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 } - this.$emit("getTimeLength", tags.length); - // 用于触底刷新 为数据赋值:通过展开运算符的形式,进行新旧数据的拼接 - this.productList = [...this.productList, ...res.data.data] - //这用于上架时间和点赞量的数据切换 - // this.productList = res.data.data + }).finally(_ => { }) diff --git a/components/uni-searchbar.vue b/components/uni-searchbar.vue index 825dcd8..96b2100 100644 --- a/components/uni-searchbar.vue +++ b/components/uni-searchbar.vue @@ -7,18 +7,14 @@ - - + + - 搜索优质商品 + 搜索优质商品 搜索 @@ -65,10 +61,10 @@ }, methods: { goSearch(value) { - if(!this.queryParamF && value) { + if (!this.queryParamF && value) { this.queryParamF = value } - if(this.readOnly) { + if (this.readOnly) { this.$emit('navigate') return } @@ -94,12 +90,14 @@ 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; @@ -107,6 +105,7 @@ border-radius: 50rpx; height: 100%; margin-left: 10rpx; + .search-btn { font-size: 32rpx; font-family: PingFangSC-Regular, PingFang SC; diff --git a/manifest.json b/manifest.json index d6a5f62..be8d37c 100644 --- a/manifest.json +++ b/manifest.json @@ -17,7 +17,9 @@ "delay": 0 }, /* 模块配置 */ - "modules": {}, + "modules": { + "Share": {} + }, /* 应用发布信息 */ "distribute": { /* android打包配置 */ @@ -43,7 +45,14 @@ /* ios打包配置 */ "ios": {}, /* SDK配置 */ - "sdkConfigs": {} + "sdkConfigs": { + "share": { + "weixin": { + "appid": "wx8da30ba464a770ba", + "UniversalLinks": "" + } + } + } } }, /* 快应用特有相关 */ diff --git a/package-lock.json b/package-lock.json index 138868d..e307ef7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2,25 +2,11 @@ "name": "pupil", "lockfileVersion": 2, "requires": true, - "packages": { - "": { - "dependencies": { - "uview-ui": "^2.0.35" - } - }, - "node_modules/uview-ui": { - "version": "2.0.36", - "resolved": "https://registry.npmmirror.com/uview-ui/-/uview-ui-2.0.36.tgz", - "integrity": "sha512-ASSZT6M8w3GTO1eFPbsgEFV0U5UujK+8pTNr+MSUbRNcRMC1u63DDTLJVeArV91kWM0bfAexK3SK9pnTqF9TtA==", - "engines": { - "HBuilderX": "^3.1.0" - } - } - }, + "lockfileVersion": 1, "dependencies": { "uview-ui": { "version": "2.0.36", - "resolved": "https://registry.npmmirror.com/uview-ui/-/uview-ui-2.0.36.tgz", + "resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-2.0.36.tgz", "integrity": "sha512-ASSZT6M8w3GTO1eFPbsgEFV0U5UujK+8pTNr+MSUbRNcRMC1u63DDTLJVeArV91kWM0bfAexK3SK9pnTqF9TtA==" } } diff --git a/package.json b/package.json index 888cf7d..49fd105 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { "dependencies": { - "uview-ui": "^2.0.35" + "uview-ui": "^2.0.36" } } diff --git a/packageMy/bindCompany/bindCompany.vue b/packageMy/bindCompany/bindCompany.vue index c74d996..ca58d82 100644 --- a/packageMy/bindCompany/bindCompany.vue +++ b/packageMy/bindCompany/bindCompany.vue @@ -21,29 +21,32 @@ } }, methods: { - handleSureClick() { - let name = this.$refs.nameAndphone.model.userInfo.name - let phone = this.$refs.nameAndphone.model.userInfo.phone - 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() { - this.showM = false - // uni.switchTab({ - // url: '/pages/my/my' - // }) - } + // 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' + // }) + // } } } diff --git a/packageMy/changeAvatar/changeAvatar.vue b/packageMy/changeAvatar/changeAvatar.vue index f22e39a..f02d440 100644 --- a/packageMy/changeAvatar/changeAvatar.vue +++ b/packageMy/changeAvatar/changeAvatar.vue @@ -3,7 +3,6 @@ - @@ -40,17 +39,20 @@ //获取头像昵称 getUser() { this.$apiServe.getUser().then(res => { - console.log('头像昵称', res.data); var data = res.data.data - this.avatar = data.avatar - this.model.userInfo.name = data.nickname + 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 + '/upload/image/', + url: apiService.uploadImgUrl, filePath: filePath, name: 'file', header: { @@ -58,10 +60,7 @@ 'Authorization': token }, success: (res) => { - console.log('上传头像', JSON.parse(res.data)); - // setTimeout(() => { resolve(JSON.parse(res.data).data.url) - // }, 1000) } }); }) @@ -78,7 +77,6 @@ const result = this.updatePromise(res.tempFilePaths[0]) //上传图片 result.then(value => { this.avatarUrl = '/' + value - console.log(this.avatarUrl); }) } } diff --git a/packageMy/memberCenter/memberCenter.vue b/packageMy/memberCenter/memberCenter.vue index 34ee662..23687d4 100644 --- a/packageMy/memberCenter/memberCenter.vue +++ b/packageMy/memberCenter/memberCenter.vue @@ -3,13 +3,14 @@ - + {{commitment}} - + + @@ -23,43 +24,79 @@ name: '', phone: '', showM: false, + btnText: '升级VIP', + btnDisabled: false, //部分产品无权限访问,需升级VIP needAsk: '', //会员中心的用户名旁边不显示edit图标 show: false, content: `请保持手机畅通
客服会及时联系您`, - commitment: '承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置' + commitment: '' } }, onLoad(option) { - console.log('ask', option.ask); + 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() { - let name = this.$refs.nameAndphone.model.userInfo.name - let phone = this.$refs.nameAndphone.model.userInfo.phone - this.$apiServe.bindComponyAndUpdate({ - uid: 1, - 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('请完善数据') + 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 } - }).finally(_ => {}) + 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() { - this.showM = false + uni.reLaunch({ + url: '/pages/my/my' + }) if (this.needAsk == 1) { - uni.switchTab({ + uni.reLaunch({ url: '/pages/index/index' }) } diff --git a/packageMy/myRelease/myRelease.vue b/packageMy/myRelease/myRelease.vue index 55949ca..9818231 100644 --- a/packageMy/myRelease/myRelease.vue +++ b/packageMy/myRelease/myRelease.vue @@ -11,14 +11,19 @@ - {{item.pub_time}} + {{item.update_time}} + {{item.update_time}} - + + + 查看 + + 修改 - + 删除 @@ -32,14 +37,20 @@ {{item.pname}} - {{item.pub_time}} + + {{item.update_time}} + {{item.update_time}} - + + + 查看 + + 修改 - + 删除 @@ -74,27 +85,28 @@ name: '创意发布' }], needsList: [], - ideasList: [] + ideasList: [], + updateIndex: '' } }, onLoad(options) { - console.log(options) - if(options && options.index) { - console.log(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 => { - console.log('获取创意发布&需求发布', res.data.data); 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 @@ -113,7 +125,6 @@ //切换需求发布和创意发布 tabChange(data) { this.tabCurrent = data.index - // console.log('data.index', data.index); if (data.index == 0) { this.type = 1 } else if (data.index == 1) { @@ -121,17 +132,32 @@ } 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 - }) - } + 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 + }) + } }) }, //二次确认删除我的需求或创意 @@ -143,7 +169,6 @@ success: function(res) { if (res.confirm) { that.$apiServe.deleteIdeasAndNeeds(item.id).then(res => { - // console.log('删除发布', res); if (res.data.code == 1) { that.$toast.warn('删除成功') } diff --git a/packageReport/certifiedCj/certifiedCj.vue b/packageReport/certifiedCj/certifiedCj.vue index da2df04..8acf369 100644 --- a/packageReport/certifiedCj/certifiedCj.vue +++ b/packageReport/certifiedCj/certifiedCj.vue @@ -1,7 +1,21 @@ @@ -9,11 +23,46 @@ export default { data() { return { - cjsShow: true + 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: { - // this.cjsShow = this.list.length === 0 ? true : false + // 获取认证厂家列表 + 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 + }) + } } } diff --git a/packageReport/certifiedCjDetail/certifiedCjDetail.vue b/packageReport/certifiedCjDetail/certifiedCjDetail.vue index 2e26956..aa07e3f 100644 --- a/packageReport/certifiedCjDetail/certifiedCjDetail.vue +++ b/packageReport/certifiedCjDetail/certifiedCjDetail.vue @@ -21,10 +21,17 @@
- + 联系客服 + + + {{mobile}} + 是否拨打客服电话 + + @@ -44,30 +51,41 @@ id: '', detailList: [], imgUrl: '', - isLoad: true + isLoad: true, + showCall: false, + mobile: '', } }, onLoad(option) { + this.imgUrl = uni.getStorageSync('img_url') this.id = option.id this.getCertifiedCjDetail() - this.imgUrl = uni.getStorageSync('img_url') - if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) { - this.isLoad = false - // uni.navigateTo({ - // url: '../../pages/my/login/login' - // }) - return - } - this.isLoad = true + 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 => { - // console.log('认证厂家详情页', res.data) + if (res.data.code === -1) { + this.isLoad = false + } + console.log('认证厂家详情页', res.data) if (res.data.data) { let data = res.data.data - data.images = data.images.split(';') + if (data.images) { + data.images = data.images.split(';') + } this.detailList = data } else { this.$toast.warn('没有更多详情了') @@ -78,22 +96,47 @@ 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.getCertifiedCjDetail() }, failToLoad() { - this.$toast.warn('登录失败请重试') + 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 } } } diff --git a/pages/ideasAndNeeds/ideasAndNeeds.vue b/pages/ideasAndNeeds/ideasAndNeeds.vue index bbc945c..b0fff37 100644 --- a/pages/ideasAndNeeds/ideasAndNeeds.vue +++ b/pages/ideasAndNeeds/ideasAndNeeds.vue @@ -9,10 +9,10 @@ + placeholder-style="color:#CCCCCC" :disabled="btnDisabled" disabledColor="#ffffff" /> - + {{needsPublishForm.area_name}} 请选择所在城市 @@ -26,39 +26,46 @@ + placeholder-style="color:#CCCCCC" :disabled="btnDisabled" disabledColor="#ffffff" /> - + {{needsPublishForm.class}} 请选择分类 + @cancel="showCategoryPicker = false" @confirm="getCategoryValue"> + - + {{needsPublishForm.product}} 请选择产品类型 + @cancel="showProductPicker = false" @confirm="getProductValue"> + - + {{needsPublishForm.loc}} 请选择产品定位 + @cancel="showPositionPicker = false" @confirm="getPositionValue"> + + :maxlength="120" placeholder-style="color:#CCCCCC" :disabled="btnDisabled" + disabledColor="#ffffff"> @@ -66,7 +73,7 @@ + name="1" multiple :maxCount="10" :disabled="btnDisabled"> @@ -81,21 +88,23 @@ :customStyle="{marginRight: '16px'}" label="手机" name="mobile" + :disabled="btnDisabled" > + placeholder-style="color:#CCCCCC" :disabled="btnDisabled" disabledColor="#ffffff"> - @@ -114,12 +123,15 @@ --> - + - - - 您在确认发布后,会由平台管理方经行审核。审核通过后,予以发布。对于用户在本站发表的信息,由用户个人承担对应责任,本平台不承担任何法律责任。 - + + {{claim_r}} + {{claim_c}} @@ -143,6 +155,9 @@ }, data() { return { + btnDisabled: false, + claim_r: '', + claim_c: '', tabsList: [{ name: '需求发布' }, { @@ -163,18 +178,13 @@ productPickerList: [], productPickerColumn: [ [] - // {name: '烘焙', val: 'hongbei'} - // {name: '零食', val: 'ls'} - // {name: '饮料', val: 'yl'} ], positionPickerList: [], positionPickerColumn: [ [] ], categoryPickerList: [], - fileList1: [ - // uploads/images/20230117/202301172309397deda1543.jpg - ], + fileList1: [], isLoad: true, cateName: null, tagName: null, @@ -183,17 +193,11 @@ } }, onTabItemTap() { - console.log('----onShow') - // if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) { - // console.log(uni.getStorageSync('loginToken')) - // this.isLoad = false - // // uni.navigateTo({ - // // url: '../../pages/my/login/login' - // // }) - // return - // } this.imgUrl = uni.getStorageSync('img_url') - console.log(this.imgUrl) + if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) { + this.isLoad = false + return + } this.isLoad = true this.token = uni.getStorageSync('loginToken') this.tabCurrent = 0 @@ -201,23 +205,18 @@ this.needsPublishForm = {} }, onLoad(options) { - console.log('---onLoad') - console.log(options.item) this.imgUrl = uni.getStorageSync('img_url') //我的发布点击修改回显数据 - if(options && options.item && uni.getStorageSync(options.item)) { - try{ + if (options && options.item && uni.getStorageSync(options.item)) { + try { let publishFormList = uni.getStorageSync(options.item) - console.log(publishFormList.images) this.fileList1 = publishFormList.images.map(item => { - console.log(this.imgUrl) return { url: item } }) - console.log(this.fileList1) this.needsPublishForm = publishFormList - } catch(error) { + } catch (error) { this.$toast.warn(error) } } @@ -226,6 +225,9 @@ } else if (options.index == 1) { this.tabCurrent = 1 } + if (options.view == 11) { + this.btnDisabled = true + } // this.getProductPickerList() }, onShow() { @@ -235,20 +237,24 @@ tabChange(data) { this.tabCurrent = data.index this.needsPublishForm = {} + this.fileList1 = [] + this.btnDisabled = this.btnDisabled == true ? false : false; }, getFormData() { this.$apiServe.getIdeasAndNeedsFormdata().then(res => { - console.log(res.data.data) 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(_ => {}) + }).finally(_ => { + }) }, // getProductPickerList() { // const data = {} @@ -279,7 +285,6 @@ // } // }, getCityValue(data) { - console.log(data) this.showCityPicker = false this.needsPublishForm.area_name = data[0].join('-') this.needsPublishForm.area_code = data[1] @@ -288,7 +293,6 @@ this.showProductPicker = false this.showCategoryPicker = false this.needsPublishForm.product = data.value[0] - // console.log(data) // const obj = this.productPickerList.find(item => { // return item.name === data.value[0] // }) @@ -342,9 +346,6 @@ async afterRead(event) { // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式 let lists = [].concat(event.file) - console.log(this.fileList1) - console.log(lists) - console.log(this[`fileList${event.name}`]) let fileListLen = this[`fileList${event.name}`].length lists.map((item) => { this[`fileList${event.name}`].push({ @@ -354,7 +355,6 @@ }) }) for (let i = 0; i < lists.length; i++) { - console.log(lists[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, { @@ -367,16 +367,6 @@ }, uploadFilePromise(url) { return new Promise((resolve, reject) => { - // const data = { - // file: new File - // } - // let a = apiService.postImage(data).then(res => { - // console.log(res) - // }) - console.log('--345') - console.log(url) - console.log(this.token) - console.log(apiService.uploadImgUrl) let a = uni.uploadFile({ url: apiService.uploadImgUrl, filePath: url, @@ -387,8 +377,6 @@ }, success: (res) => { setTimeout(() => { - console.log('---355') - console.log(JSON.parse(res.data).data.url) resolve(JSON.parse(res.data).data.url) }, 1000) } @@ -396,7 +384,6 @@ }) }, submitForm() { - console.log(this.fileList1) if (this.needsPublishForm.contactWay === 'mobile' && !/^1[3456789]\d{9}$/.test(this.needsPublishForm.mobile)) { this.$toast.warn('请输入正确的手机号') return false @@ -406,12 +393,12 @@ } 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) + 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+'/', '')) + temp.push(url.replace(this.imgUrl + '/', '')) }) } this.needsPublishForm.images = temp.join(';') @@ -434,10 +421,10 @@ apiService.submitIdeasAndNeeds(data).then(res => { this.$toast.success('提交成功') console.log('esf=', res); - if(this.needsPublishForm.id) { - uni.navigateTo({ - url: '../../packageMy/myRelease/myRelease?index=' + (this.tabCurrent + 1) - }) + if (this.needsPublishForm.id) { + uni.navigateTo({ + url: '../../packageMy/myRelease/myRelease?index=' + (this.tabCurrent + 1) + }) } this.tabCurrent = 0 this.fileList1 = [] @@ -447,41 +434,21 @@ this.$toast.warn(error) }) }, - reOnLoad() { - console.log('----------------true') - if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) { - this.$toast.warn('登录失败请重试') - this.isLoad = false - // uni.navigateTo({ - // url: '../../pages/my/login/login' - // }) - return - } - this.token = uni.getStorageSync('loginToken') - this.isLoad = true - this.getFormData() - }, failToLoad() { - console.log('----------------false') this.$toast.warn('登录失败请重试') uni.reLaunch({ url: '/pages/index/index' }) - // uni.navigateBack({ - // success: () => { - // let page = getCurrentPages().pop(); - // if (page) { - // page.onLoad(page.options);//执行上个页面的方法 - // }; - // } - // }) } } - }