增加用户图标编辑功能
This commit is contained in:
parent
e73c80c1a9
commit
5031aed2cb
4
app.json
4
app.json
@ -34,7 +34,9 @@
|
|||||||
"pages/home/chemical/chemical",
|
"pages/home/chemical/chemical",
|
||||||
"pages/additive/list/additive-list",
|
"pages/additive/list/additive-list",
|
||||||
"pages/standard/list/index",
|
"pages/standard/list/index",
|
||||||
"pages/user/index"
|
"pages/user/index",
|
||||||
|
"pages/user/session-list/index",
|
||||||
|
"pages/user/edit/index"
|
||||||
],
|
],
|
||||||
"tabBar": {
|
"tabBar": {
|
||||||
"custom": true,
|
"custom": true,
|
||||||
|
|||||||
BIN
images/check.png
Normal file
BIN
images/check.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 42 KiB |
BIN
images/history.png
Normal file
BIN
images/history.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
BIN
images/question.png
Normal file
BIN
images/question.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.2 KiB |
BIN
images/use_btn.jpg
Normal file
BIN
images/use_btn.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.3 KiB |
@ -1,5 +1,5 @@
|
|||||||
const images = [{
|
const images = [{
|
||||||
img: '/images/use_bi.jpg',
|
img: '/images/use_btn.jpg',
|
||||||
text: '1',
|
text: '1',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -14,7 +14,7 @@ Page({
|
|||||||
addtiveList: [],
|
addtiveList: [],
|
||||||
page: {
|
page: {
|
||||||
num: 1,
|
num: 1,
|
||||||
size: 20,
|
size: 10,
|
||||||
total: 0
|
total: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -26,7 +26,7 @@ Page({
|
|||||||
this.getAddtiveList();
|
this.getAddtiveList();
|
||||||
},
|
},
|
||||||
|
|
||||||
getAddtiveList() {
|
getAddtiveList(append) {
|
||||||
console.log(this.data.searchValue);
|
console.log(this.data.searchValue);
|
||||||
const params = {
|
const params = {
|
||||||
pageNumber: this.data.page.num,
|
pageNumber: this.data.page.num,
|
||||||
@ -36,10 +36,17 @@ Page({
|
|||||||
params['search'] = this.data.searchValue
|
params['search'] = this.data.searchValue
|
||||||
}
|
}
|
||||||
sessionAdditiveList(params).then(respose => {
|
sessionAdditiveList(params).then(respose => {
|
||||||
this.setData({
|
if (append) {
|
||||||
addtiveList: respose.content.contentList,
|
this.setData({
|
||||||
"page.total": respose.content.total
|
addtiveList: this.data.addtiveList.concat(respose.content.contentList),
|
||||||
})
|
"page.total": respose.content.total
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.setData({
|
||||||
|
addtiveList: respose.content.contentList,
|
||||||
|
"page.total": respose.content.total
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -99,7 +106,11 @@ Page({
|
|||||||
* 页面上拉触底事件的处理函数
|
* 页面上拉触底事件的处理函数
|
||||||
*/
|
*/
|
||||||
onReachBottom() {
|
onReachBottom() {
|
||||||
|
const num = this.data.page.num;
|
||||||
|
this.setData({
|
||||||
|
"page.num": num + 1
|
||||||
|
})
|
||||||
|
this.getAddtiveList(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -12,15 +12,15 @@
|
|||||||
<text style="width: 50%;">cns: {{additiveData.cns ? additiveData.cns : '-'}}</text>
|
<text style="width: 50%;">cns: {{additiveData.cns ? additiveData.cns : '-'}}</text>
|
||||||
<text style="width: 50%;">ins: {{additiveData.ins ? additiveData.ins : '-'}}</text>
|
<text style="width: 50%;">ins: {{additiveData.ins ? additiveData.ins : '-'}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view style="display: flex; margin-left: 20px; margin-right: 20px;">
|
<view style="display: flex; margin-left: 20px; margin-right: 20px; flex-wrap: wrap;">
|
||||||
<t-tag wx:for="{{additiveData.functions}}" wx:key="index" wx:for-item="item" variant="light-outline" theme="primary">{{item}}</t-tag>
|
<t-tag wx:for="{{additiveData.functions}}" wx:key="index" wx:for-item="item" variant="light-outline" theme="primary" style="margin-right: 5px; margin-bottom: 5px;">{{item}}</t-tag>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view wx:if="{{additiveData.description != ''}}" class="main-item">
|
<view wx:if="{{additiveData.description != ''}}" class="main-item">
|
||||||
<view class="main-title">描述</view>
|
<view class="main-title">描述</view>
|
||||||
<view style="margin: 10px;">{{additiveData.description}}</view>
|
<view style="margin: 10px;">{{additiveData.description}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="main-item">
|
<view class="main-item" wx:if="{{additiveData.chemicals.length != 0}}">
|
||||||
<view class="main-title">包含物质</view>
|
<view class="main-title">包含物质</view>
|
||||||
<view class="chemical-item" wx:for="{{additiveData.chemicals}}" wx:key="index" wx:for-item="item" data-chemical="{{item.id}}" bindtap="onGoChemical">
|
<view class="chemical-item" wx:for="{{additiveData.chemicals}}" wx:key="index" wx:for-item="item" data-chemical="{{item.id}}" bindtap="onGoChemical">
|
||||||
<view>
|
<view>
|
||||||
|
|||||||
@ -9,7 +9,12 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="home-page-container">
|
<view class="home-page-container">
|
||||||
<!-- <t-button bindtap="textButton"></t-button> -->
|
<!-- <t-button bindtap="textButton"></t-button> -->
|
||||||
<t-image t-class="searich_btn" shape="round" mode="heightFix" src="/images/search.jpg" bind:tap="uploadPicture" />
|
<view class="container">
|
||||||
|
<t-image t-class="search_img" shape="round" mode="heightFix" src="/images/check.png" />
|
||||||
|
</view>
|
||||||
|
<view class="container">
|
||||||
|
<button class="search_btn" theme="default" size="large" bind:tap="uploadPicture" block>扫一扫</button>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="home-page-ad"></view> -->
|
<!-- <view class="home-page-ad"></view> -->
|
||||||
<t-dialog visible="{{loadingDialog}}" cancel-btn="取消操作" bind:cancel="onCloseDialog">
|
<t-dialog visible="{{loadingDialog}}" cancel-btn="取消操作" bind:cancel="onCloseDialog">
|
||||||
|
|||||||
@ -27,15 +27,30 @@ page {
|
|||||||
bottom: 82px;
|
bottom: 82px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.home-page-container .searich_btn {
|
.home-page-container {
|
||||||
position: absolute;
|
height: 100%;
|
||||||
left: 0;
|
}
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
.container {
|
||||||
top: 0;
|
display: flex;
|
||||||
margin: auto;
|
justify-content: center;
|
||||||
border-radius: 20px;
|
flex-wrap: wrap;
|
||||||
box-shadow: 4px 4px 4px 4px rgb(187, 187, 187);
|
margin-top: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search_img {
|
||||||
|
width: 200px;
|
||||||
|
height: 200px;
|
||||||
|
/* border-radius: 20px;
|
||||||
|
box-shadow: -1px 4px 2px 4px rgb(187, 187, 187); */
|
||||||
|
}
|
||||||
|
|
||||||
|
.search_btn {
|
||||||
|
width: 100%;
|
||||||
|
margin-left: 70px;
|
||||||
|
margin-right: 70px;
|
||||||
|
background-color: #ffcd38;
|
||||||
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.home-page-container,
|
.home-page-container,
|
||||||
|
|||||||
@ -3,6 +3,9 @@ import {
|
|||||||
sessionQuery,
|
sessionQuery,
|
||||||
sessionAdditiveQuery
|
sessionAdditiveQuery
|
||||||
} from '../../../services/api/session';
|
} from '../../../services/api/session';
|
||||||
|
import {
|
||||||
|
sessionUpload
|
||||||
|
} from '../../../services/api/session';
|
||||||
|
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
@ -18,18 +21,18 @@ Page({
|
|||||||
kinds: []
|
kinds: []
|
||||||
},
|
},
|
||||||
address: [],
|
address: [],
|
||||||
company: ["浏阳市青草学堂食品厂"],
|
company: [],
|
||||||
images: [""],
|
images: [],
|
||||||
licenseCode: ["SC11643018106863"],
|
licenseCode: [],
|
||||||
sessionId: 0,
|
sessionId: 0,
|
||||||
standard: "Q/AQCX0001S",
|
standard: "",
|
||||||
standardType: "企业标准",
|
standardType: "",
|
||||||
tags: ["反式脂肪酸", "添加剂"],
|
tags: [],
|
||||||
typeCode: "",
|
typeCode: "",
|
||||||
typeName: "",
|
typeName: "",
|
||||||
rate: {
|
rate: {
|
||||||
level: 4,
|
level: 4,
|
||||||
text: '不建议儿童食用',
|
text: '',
|
||||||
type: ''
|
type: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -43,6 +46,10 @@ Page({
|
|||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.sessionId = options?.sessionId;
|
this.sessionId = options?.sessionId;
|
||||||
// this.sessionId = 76
|
// this.sessionId = 76
|
||||||
|
this.init();
|
||||||
|
},
|
||||||
|
|
||||||
|
init() {
|
||||||
sessionQuery({
|
sessionQuery({
|
||||||
id: this.sessionId
|
id: this.sessionId
|
||||||
}).then(respose => {
|
}).then(respose => {
|
||||||
@ -55,7 +62,7 @@ Page({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
sessionAdditiveQuery({
|
sessionAdditiveQuery({
|
||||||
id: this.data.sessionId
|
id: this.sessionId
|
||||||
}).then(respose => {
|
}).then(respose => {
|
||||||
this.setData({
|
this.setData({
|
||||||
additives: respose.content.additives
|
additives: respose.content.additives
|
||||||
@ -129,10 +136,42 @@ Page({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onAddImage() {
|
||||||
|
if (this.sessionId == 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
wx.chooseMedia({
|
||||||
|
count: 1,
|
||||||
|
mediaType: ['image'],
|
||||||
|
sourceType: ['album', 'camera'],
|
||||||
|
maxDuration: 30,
|
||||||
|
camera: 'back',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.tempFiles.length >= 1) {
|
||||||
|
sessionUpload({
|
||||||
|
urls: res.tempFiles,
|
||||||
|
session: this.sessionId
|
||||||
|
}).then(tmp => {
|
||||||
|
console.log(tmp);
|
||||||
|
if (tmp.code == 10000) {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
onGoAdditive(event) {
|
onGoAdditive(event) {
|
||||||
const additiveId = event.currentTarget.dataset.additive;
|
const additiveId = event.currentTarget.dataset.additive;
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: `/pages/home/additive/additive?additiveId=${additiveId}`,
|
url: `/pages/home/additive/additive?additiveId=${additiveId}`,
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
onGoChemical(event) {
|
||||||
|
const chemicalId = event.currentTarget.dataset.chemical;
|
||||||
|
wx.navigateTo({
|
||||||
|
url: `/pages/home/chemical/chemical?chemicalId=${chemicalId}`,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -13,7 +13,7 @@
|
|||||||
<view class="header-time">{{pageData.createTime}}</view>
|
<view class="header-time">{{pageData.createTime}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="right">
|
<view class="right">
|
||||||
<t-icon class="header-icon" data-name="add-rectangle" name="add-rectangle" size="64rpx" bind:click="onIconTap" />
|
<t-icon class="header-icon" data-name="add-rectangle" name="add-rectangle" size="64rpx" bind:click="onAddImage" />
|
||||||
<t-badge count="{{pageData.images.length}}" color="#0052d9" offset="{{ [64, 8] }}">
|
<t-badge count="{{pageData.images.length}}" color="#0052d9" offset="{{ [64, 8] }}">
|
||||||
<image class="header-image" wx:if="{{ pageData.images.length >= 1 }}" src="{{ pageData.images[0] }} " bindtap="onShowImages"></image>
|
<image class="header-image" wx:if="{{ pageData.images.length >= 1 }}" src="{{ pageData.images[0] }} " bindtap="onShowImages"></image>
|
||||||
</t-badge>
|
</t-badge>
|
||||||
@ -108,7 +108,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="additive-standard">{{item.standard}}</view>
|
<view class="additive-standard">{{item.standard}}</view>
|
||||||
<view class="body-key" style="margin-bottom: 10px;" wx:if="{{item.chemicals.lenth != 0}}">所含元素:</view>
|
<view class="body-key" style="margin-bottom: 10px;" wx:if="{{item.chemicals.lenth != 0}}">所含元素:</view>
|
||||||
<view class="additive-chemical" wx:for="{{item.chemicals}}" wx:key="index" wx:for-item="chemical">
|
<view class="additive-chemical" wx:for="{{item.chemicals}}" wx:key="index" wx:for-item="chemical" data-chemical="{{chemical.id}}" bindtap="onGoChemical">
|
||||||
<view class="additive-chemical-left">
|
<view class="additive-chemical-left">
|
||||||
<view class="additive-chemical-name">{{chemical.name}}</view>
|
<view class="additive-chemical-name">{{chemical.name}}</view>
|
||||||
<view class="additive-chemical-cas">{{chemical.cas}}</view>
|
<view class="additive-chemical-cas">{{chemical.cas}}</view>
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
import {
|
import {
|
||||||
sessionStandardList
|
sessionStandardList
|
||||||
} from '../../../services/api/standard';
|
} from '../../../services/api/standard';
|
||||||
|
import Message from 'tdesign-miniprogram/message/index';
|
||||||
|
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
@ -42,19 +43,41 @@ Page({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
getStandardList() {
|
getStandardList(append) {
|
||||||
const params = {
|
const params = {
|
||||||
pageNumber: this.data.page.num,
|
pageNumber: this.data.page.num,
|
||||||
pageSize: this.data.page.size
|
pageSize: this.data.page.size
|
||||||
}
|
}
|
||||||
if (this.data.searchValue) {
|
if (this.data.searchValue) {
|
||||||
params['search'] = this.data.searchValue
|
params['search'] = this.data.searchValue
|
||||||
sessionStandardList(params).then(respose => {
|
if (append) {
|
||||||
this.setData({
|
sessionStandardList(params).then(respose => {
|
||||||
standardList: respose.content.contentList,
|
this.setData({
|
||||||
"page.total": respose.content.total
|
standardList: this.data.standardList.concat(respose.content.contentList),
|
||||||
|
"page.total": respose.content.total
|
||||||
|
})
|
||||||
|
this.handleWarning();
|
||||||
})
|
})
|
||||||
})
|
} else {
|
||||||
|
sessionStandardList(params).then(respose => {
|
||||||
|
this.setData({
|
||||||
|
standardList: respose.content.contentList,
|
||||||
|
"page.total": respose.content.total
|
||||||
|
})
|
||||||
|
this.handleWarning();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
handleWarning() {
|
||||||
|
if (this.data.standardList.length == 0) {
|
||||||
|
Message.warning({
|
||||||
|
context: this,
|
||||||
|
offset: [20, 32],
|
||||||
|
duration: 5000,
|
||||||
|
content: '未查询到该信息,请重新尝试!',
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -97,7 +120,15 @@ Page({
|
|||||||
* 页面上拉触底事件的处理函数
|
* 页面上拉触底事件的处理函数
|
||||||
*/
|
*/
|
||||||
onReachBottom() {
|
onReachBottom() {
|
||||||
|
console.log(this.data.standardList.length);
|
||||||
|
if (this.data.standardList.length >= this.data.page.total) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const num = this.data.page.num;
|
||||||
|
this.setData({
|
||||||
|
"page.num": num + 1
|
||||||
|
})
|
||||||
|
this.getStandardList(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,8 +1,13 @@
|
|||||||
{
|
{
|
||||||
|
"navigationBarTitleText": "标准",
|
||||||
|
"onReachBottomDistance": 10,
|
||||||
|
"backgroundTextStyle": "light",
|
||||||
"usingComponents": {
|
"usingComponents": {
|
||||||
"t-search": "tdesign-miniprogram/search/search",
|
"t-search": "tdesign-miniprogram/search/search",
|
||||||
"t-tag": "tdesign-miniprogram/tag/tag",
|
"t-tag": "tdesign-miniprogram/tag/tag",
|
||||||
"t-check-tag": "tdesign-miniprogram/tag/check-tag",
|
"t-check-tag": "tdesign-miniprogram/tag/check-tag",
|
||||||
|
"t-sticky": "tdesign-miniprogram/sticky/sticky",
|
||||||
|
"t-message": "tdesign-miniprogram/message/message",
|
||||||
"t-image": "tdesign-miniprogram/image/image"
|
"t-image": "tdesign-miniprogram/image/image"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,9 +1,11 @@
|
|||||||
<!--pages/standard/list/index.wxml-->
|
<!--pages/standard/list/index.wxml-->
|
||||||
<view class="main">
|
<view>
|
||||||
<view wx:if="{{standardList.length == 0}}" class="top-empty"></view>
|
<view wx:if="{{standardList.length == 0}}" class="top-empty"></view>
|
||||||
<view class="search-view">
|
<t-sticky disabled="{{standardList.length == 0}}">
|
||||||
<t-search t-class="search" placeholder="搜索标准" shape="round" bind:submit="doSearch" bind:clear="doSearchClear" value="{{searchValue}}" />
|
<view class="search-view">
|
||||||
</view>
|
<t-search t-class="search" placeholder="搜索标准" shape="round" bind:submit="doSearch" bind:clear="doSearchClear" value="{{searchValue}}" />
|
||||||
|
</view>
|
||||||
|
</t-sticky>
|
||||||
<view wx:if="{{standardList.length == 0}}" class="standard-image">
|
<view wx:if="{{standardList.length == 0}}" class="standard-image">
|
||||||
<t-image shape="round" mode="heightFix" src="/images/standard.jpg" bind:tap="uploadPicture" />
|
<t-image shape="round" mode="heightFix" src="/images/standard.jpg" bind:tap="uploadPicture" />
|
||||||
</view>
|
</view>
|
||||||
@ -17,4 +19,5 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<t-message id="t-message" />
|
||||||
@ -12,6 +12,10 @@
|
|||||||
.search-view {
|
.search-view {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
padding-top: 10px;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
width: 100%;
|
||||||
|
background-color: rgb(255, 255, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
.search {
|
.search {
|
||||||
@ -25,8 +29,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.list-view {
|
.list-view {
|
||||||
margin: 10px;
|
padding: 10px;
|
||||||
margin-top: 20px;
|
|
||||||
margin-bottom: 80px;
|
margin-bottom: 80px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
114
pages/user/edit/index.js
Normal file
114
pages/user/edit/index.js
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
// pages/user/edit/index.js
|
||||||
|
|
||||||
|
import {
|
||||||
|
getUserInfo,
|
||||||
|
updateUserInfo
|
||||||
|
} from '../../../services/permission/user'
|
||||||
|
|
||||||
|
const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'
|
||||||
|
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
avatarUrl: defaultAvatarUrl,
|
||||||
|
nickname: ""
|
||||||
|
},
|
||||||
|
|
||||||
|
onChooseAvatar(e) {
|
||||||
|
const {
|
||||||
|
avatarUrl
|
||||||
|
} = e.detail
|
||||||
|
console.log(avatarUrl);
|
||||||
|
this.setData({
|
||||||
|
avatarUrl,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
onSave() {
|
||||||
|
console.log(this.data.nickname);
|
||||||
|
console.log(this.data.avatarUrl);
|
||||||
|
updateUserInfo({
|
||||||
|
nickname: this.data.nickname,
|
||||||
|
avatar: this.data.avatarUrl
|
||||||
|
}).then(res => {
|
||||||
|
console.log(res);
|
||||||
|
wx.switchTab({
|
||||||
|
url: `../index`,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
onInput(e) {
|
||||||
|
const nickname = e.detail.value;
|
||||||
|
this.setData({
|
||||||
|
nickname
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad(options) {
|
||||||
|
const tmp = getUserInfo();
|
||||||
|
let avatar = tmp.avatar
|
||||||
|
if (avatar == '') {
|
||||||
|
avatar = defaultAvatarUrl
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
avatarUrl: avatar,
|
||||||
|
nickname: tmp.nickname
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage() {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
9
pages/user/edit/index.json
Normal file
9
pages/user/edit/index.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"navigationBarTitleText": "修改信息",
|
||||||
|
"onReachBottomDistance": 10,
|
||||||
|
"backgroundTextStyle": "light",
|
||||||
|
"usingComponents": {
|
||||||
|
"t-input": "tdesign-miniprogram/input/input",
|
||||||
|
"t-button": "tdesign-miniprogram/button/button"
|
||||||
|
}
|
||||||
|
}
|
||||||
9
pages/user/edit/index.wxml
Normal file
9
pages/user/edit/index.wxml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<!--pages/user/edit/index.wxml-->
|
||||||
|
<button class="avatar-wrapper" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">
|
||||||
|
<image class="avatar" src="{{avatarUrl}}"></image>
|
||||||
|
</button>
|
||||||
|
<t-input type="nickname" value="{{nickname}}" bind:change="onInput" data-key="nickname" label="昵称" t-class="weui-input" placeholder="请输入昵称" />
|
||||||
|
|
||||||
|
<view class="button-example">
|
||||||
|
<t-button t-class="button-save" theme="primary" size="large" bindtap="onSave" block>确认保存</t-button>
|
||||||
|
</view>
|
||||||
24
pages/user/edit/index.wxss
Normal file
24
pages/user/edit/index.wxss
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/* pages/user/edit/index.wxss */
|
||||||
|
|
||||||
|
.avatar-wrapper {
|
||||||
|
margin-top: 100px;
|
||||||
|
width: 80px;
|
||||||
|
height: 80px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
width: 54px;
|
||||||
|
height: 54px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.weui-input {
|
||||||
|
margin-top: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-example {
|
||||||
|
margin: 0 32rpx;
|
||||||
|
margin-top: 100px;
|
||||||
|
}
|
||||||
@ -4,6 +4,10 @@ import {
|
|||||||
isLogin
|
isLogin
|
||||||
} from '../../services/permission/login';
|
} from '../../services/permission/login';
|
||||||
|
|
||||||
|
import {
|
||||||
|
getUserInfo
|
||||||
|
} from '../../services/permission/user'
|
||||||
|
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -11,6 +15,11 @@ Page({
|
|||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
loginStatus: false,
|
loginStatus: false,
|
||||||
|
userinfo: {
|
||||||
|
nickname: "",
|
||||||
|
avatar: ""
|
||||||
|
},
|
||||||
|
avatarImage: ""
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -20,6 +29,33 @@ Page({
|
|||||||
this.setData({
|
this.setData({
|
||||||
loginStatus: isLogin()
|
loginStatus: isLogin()
|
||||||
})
|
})
|
||||||
|
const tmp = getUserInfo()
|
||||||
|
this.setData({
|
||||||
|
userinfo: {
|
||||||
|
...tmp
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (this.data.userinfo.avatar == "") {
|
||||||
|
this.setData({
|
||||||
|
avatarImage: 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.setData({
|
||||||
|
avatarImage: this.data.userinfo.avatar
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onGoSessionList() {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: `/pages/user/session-list/index`,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
onGoEdit() {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: `/pages/user/edit/index`,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -34,6 +70,13 @@ Page({
|
|||||||
*/
|
*/
|
||||||
onShow() {
|
onShow() {
|
||||||
this.getTabBar().init();
|
this.getTabBar().init();
|
||||||
|
const tmp = getUserInfo()
|
||||||
|
this.setData({
|
||||||
|
userinfo: {
|
||||||
|
...tmp
|
||||||
|
},
|
||||||
|
avatarImage: tmp.avatar
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,6 +1,12 @@
|
|||||||
{
|
{
|
||||||
|
"navigationBarTitleText": "个人中心",
|
||||||
|
"onReachBottomDistance": 10,
|
||||||
|
"backgroundTextStyle": "light",
|
||||||
"usingComponents": {
|
"usingComponents": {
|
||||||
"t-image": "/components/webp-image/index",
|
"t-image": "/components/webp-image/index",
|
||||||
|
"t-grid": "tdesign-miniprogram/grid/grid",
|
||||||
|
"t-grid-item": "tdesign-miniprogram/grid/grid-item",
|
||||||
|
"t-icon": "tdesign-miniprogram/icon/icon",
|
||||||
"t-avatar": "tdesign-miniprogram/avatar/avatar"
|
"t-avatar": "tdesign-miniprogram/avatar/avatar"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,9 +1,20 @@
|
|||||||
<!--pages/user/index.wxml-->
|
<!--pages/user/index.wxml-->
|
||||||
<view class="user-center-card">
|
<view class="user-center-card">
|
||||||
<view class="searich_btn">
|
<view class="searich_btn">
|
||||||
<t-avatar image="/images/weixin.png" class="user-center-card__header__avatar" />
|
<t-avatar image="{{avatarImage}}" class="user-center-card__header__avatar" bindtap="onGoEdit" />
|
||||||
<view class="user-center-card__header__name">{{ loginStatus ? '微信用户' :'请登录'}}</view>
|
<view wx:if="{{loginStatus == false}}" class="user-center-card__header__name" bindtap="onGoEdit">请登录</view>
|
||||||
|
<view wx:else class="user-center-card__header__name" bindtap="onGoEdit">{{ userinfo.nickname == '' ? '微信用户' : userinfo.nickname }}</view>
|
||||||
|
<t-icon name="edit-1" bindtap="onGoEdit"></t-icon>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view></view>
|
<view class="grid-view">
|
||||||
|
<view class="grid-box">
|
||||||
|
<t-grid class="block">
|
||||||
|
<t-grid-item t-class="grid-item" text="查询记录" image="/images/history.png" bindtap="onGoSessionList" />
|
||||||
|
<t-grid-item t-class="grid-item" text="问题反馈" image="/images/question.png" />
|
||||||
|
<!-- <t-grid-item text="保存" icon="download" />
|
||||||
|
<t-grid-item text="编辑" icon="edit-1" /> -->
|
||||||
|
</t-grid>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
@ -26,6 +26,7 @@
|
|||||||
.user-center-card__header__avatar {
|
.user-center-card__header__avatar {
|
||||||
width: 96rpx;
|
width: 96rpx;
|
||||||
height: 96rpx;
|
height: 96rpx;
|
||||||
|
margin-left: 15px;
|
||||||
border-radius: 48rpx;
|
border-radius: 48rpx;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
@ -35,6 +36,35 @@
|
|||||||
line-height: 48rpx;
|
line-height: 48rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin-left: 24rpx;
|
margin-left: 32rpx;
|
||||||
margin-right: 16rpx;
|
margin-right: 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.block {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid-view {
|
||||||
|
position: fixed;
|
||||||
|
width: 100%;
|
||||||
|
top: 320rpx;
|
||||||
|
/* padding: 20px; */
|
||||||
|
padding-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid-box {
|
||||||
|
--tw-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
||||||
|
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
||||||
|
/* border-style: solid;
|
||||||
|
border-width: 2px;
|
||||||
|
border-color: rgba(230, 230, 230, 0.719); */
|
||||||
|
margin: 20px;
|
||||||
|
padding: 10px;
|
||||||
|
padding-bottom: 5px;
|
||||||
|
border-radius: 0.75rem;
|
||||||
|
background-color: #ffffff;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid-item {}
|
||||||
120
pages/user/session-list/index.js
Normal file
120
pages/user/session-list/index.js
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
// pages/user/session-list/index.js
|
||||||
|
|
||||||
|
import {
|
||||||
|
sessionList
|
||||||
|
} from '../../../services/api/session';
|
||||||
|
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
sessionDataList: [],
|
||||||
|
page: {
|
||||||
|
num: 1,
|
||||||
|
size: 20,
|
||||||
|
total: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad(options) {
|
||||||
|
|
||||||
|
this.getSessionList();
|
||||||
|
},
|
||||||
|
|
||||||
|
getSessionList(append) {
|
||||||
|
const params = {
|
||||||
|
pageNumber: this.data.page.num,
|
||||||
|
pageSize: this.data.page.size
|
||||||
|
}
|
||||||
|
if (append) {
|
||||||
|
sessionList(params).then(respose => {
|
||||||
|
this.setData({
|
||||||
|
sessionDataList: this.data.sessionDataList.concat(respose.content.contentList),
|
||||||
|
"page.total": respose.content.total
|
||||||
|
})
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
sessionList(params).then(respose => {
|
||||||
|
this.setData({
|
||||||
|
sessionDataList: respose.content.contentList,
|
||||||
|
"page.total": respose.content.total
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onGoSession(e) {
|
||||||
|
console.log(e);
|
||||||
|
const session = e.currentTarget.dataset.session;
|
||||||
|
this.goSession(session);
|
||||||
|
},
|
||||||
|
|
||||||
|
goSession(sessionId) {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: `/pages/home/session/session?sessionId=${sessionId}`,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom() {
|
||||||
|
console.log(this.data.sessionDataList.length);
|
||||||
|
if (this.data.sessionDataList.length >= this.data.page.total) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const num = this.data.page.num;
|
||||||
|
this.setData({
|
||||||
|
"page.num": num + 1
|
||||||
|
})
|
||||||
|
this.getSessionList(true);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage() {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
9
pages/user/session-list/index.json
Normal file
9
pages/user/session-list/index.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"navigationBarTitleText": "查询记录",
|
||||||
|
"onReachBottomDistance": 10,
|
||||||
|
"backgroundTextStyle": "light",
|
||||||
|
"usingComponents": {
|
||||||
|
"t-icon": "tdesign-miniprogram/icon/icon",
|
||||||
|
"t-avatar": "tdesign-miniprogram/avatar/avatar"
|
||||||
|
}
|
||||||
|
}
|
||||||
20
pages/user/session-list/index.wxml
Normal file
20
pages/user/session-list/index.wxml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<!--pages/user/session-list/index.wxml-->
|
||||||
|
<view class="main">
|
||||||
|
<view class="top-title">查询记录</view>
|
||||||
|
<view class="top-content">您已通过该软件查询物品{{page.total}}次</view>
|
||||||
|
<view class="history-list">
|
||||||
|
<view class="history-item" wx:for="{{sessionDataList}}" wx:key="index" wx:for-item="item" data-session="{{item.id}}" bindtap="onGoSession">
|
||||||
|
<view class="history-left">
|
||||||
|
<t-avatar t-class="history-avatar" image="{{item.images[0]}}" />
|
||||||
|
<view class="history-content">
|
||||||
|
<view class="history-title">{{item.createTime}}</view>
|
||||||
|
<view class="history-text">{{item.additive}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="history-right">
|
||||||
|
<t-icon color="rgb(255, 191, 52)" name="star-filled" size="48rpx" data-name="star-filled" />
|
||||||
|
<view>{{item.rate}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
62
pages/user/session-list/index.wxss
Normal file
62
pages/user/session-list/index.wxss
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
/* pages/user/session-list/index.wxss */
|
||||||
|
|
||||||
|
.main {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-title {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
line-height: 2rem;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-content {
|
||||||
|
color: rgb(150, 150, 150);
|
||||||
|
margin-left: 10px;
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-item {
|
||||||
|
--tw-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
||||||
|
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
||||||
|
border-style: solid;
|
||||||
|
border-width: 2px;
|
||||||
|
border-color: rgba(230, 230, 230, 0.719);
|
||||||
|
margin: 5px;
|
||||||
|
margin-top: 10px;
|
||||||
|
padding: 10px;
|
||||||
|
padding-top: 15px;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
border-radius: 0.75rem;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-left {
|
||||||
|
width: 100%;
|
||||||
|
padding-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-avatar {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-title {
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-text {
|
||||||
|
color: rgb(150, 150, 150);
|
||||||
|
font-size: 0.875rem;
|
||||||
|
line-height: 1.25rem;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-right {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
color: rgb(255, 191, 52);
|
||||||
|
}
|
||||||
@ -1,29 +1,15 @@
|
|||||||
<t-user-center-card userInfo="{{userInfo}}" isPhoneHide="{{true}}" name-class="custom-name-class" phone-class="custom-phone-class" avatar-class="custome-avatar-class" currAuthStep="{{currAuthStep}}" bind:gotoUserEditPage="gotoUserEditPage" />
|
<t-user-center-card userInfo="{{userInfo}}" isPhoneHide="{{true}}" name-class="custom-name-class" phone-class="custom-phone-class" avatar-class="custome-avatar-class" currAuthStep="{{currAuthStep}}" bind:gotoUserEditPage="gotoUserEditPage" />
|
||||||
<view class="content-wrapper">
|
<view class="content-wrapper">
|
||||||
<!-- <view class='order-group-wrapper'>
|
<view class='order-group-wrapper'>
|
||||||
<t-order-group orderTagInfos="{{orderTagInfos}}" bind:onClickTop="jumpAllOrder" bind:onClickItem="jumpNav" />
|
<t-order-group orderTagInfos="{{orderTagInfos}}" bind:onClickTop="jumpAllOrder" bind:onClickItem="jumpNav" />
|
||||||
</view> -->
|
</view>
|
||||||
<!-- <view wx:for="{{menuData}}" wx:key="item" class="cell-box">
|
<view wx:for="{{menuData}}" wx:key="item" class="cell-box">
|
||||||
<t-cell-group>
|
<t-cell-group>
|
||||||
<t-cell
|
<t-cell wx:for="{{item}}" wx:for-item="xitem" wx:for-index="xindex" wx:key="xindex" title="{{xitem.title}}" arrow="{{!xitem.icon}}" note="{{xitem.tit}}" data-type="{{xitem.type}}" bordered="{{false}}" bind:click="onClickCell" t-class="t-cell-padding" t-class-note="order-group-note" t-class-left="order-group__left">
|
||||||
wx:for="{{item}}"
|
<t-icon name="{{xitem.icon}}" size="48rpx" slot="note" />
|
||||||
wx:for-item="xitem"
|
</t-cell>
|
||||||
wx:for-index="xindex"
|
</t-cell-group>
|
||||||
wx:key="xindex"
|
</view>
|
||||||
title="{{xitem.title}}"
|
|
||||||
arrow="{{!xitem.icon}}"
|
|
||||||
note="{{xitem.tit}}"
|
|
||||||
data-type="{{xitem.type}}"
|
|
||||||
bordered="{{false}}"
|
|
||||||
bind:click="onClickCell"
|
|
||||||
t-class="t-cell-padding"
|
|
||||||
t-class-note="order-group-note"
|
|
||||||
t-class-left="order-group__left"
|
|
||||||
>
|
|
||||||
<t-icon name="{{xitem.icon}}" size="48rpx" slot="note" />
|
|
||||||
</t-cell>
|
|
||||||
</t-cell-group>
|
|
||||||
</view> -->
|
|
||||||
</view>
|
</view>
|
||||||
<view class="footer__version" wx:if="{{versionNo !== ''}}">当前版本 {{versionNo}}</view>
|
<view class="footer__version" wx:if="{{versionNo !== ''}}">当前版本 {{versionNo}}</view>
|
||||||
<t-popup visible="{{showMakePhone}}" placement="bottom" bind:visible-change="closeMakePhone" data-index="2">
|
<t-popup visible="{{showMakePhone}}" placement="bottom" bind:visible-change="closeMakePhone" data-index="2">
|
||||||
|
|||||||
@ -11,6 +11,13 @@ export function request({
|
|||||||
method
|
method
|
||||||
}) {
|
}) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
if (getToken() == '' && path != '/wx/login') {
|
||||||
|
wx.showToast({
|
||||||
|
title: '请登录后再次尝试。',
|
||||||
|
icon: 'error',
|
||||||
|
duration: 3000
|
||||||
|
})
|
||||||
|
}
|
||||||
wx.request({
|
wx.request({
|
||||||
url: baseURL + path, //仅为示例,并非真实的接口地址
|
url: baseURL + path, //仅为示例,并非真实的接口地址
|
||||||
data: params,
|
data: params,
|
||||||
|
|||||||
@ -20,20 +20,19 @@ export function sessionUpload({
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
for (let index = 0; index < urls.length; index++) {
|
return new Promise((resolve, reject) => {
|
||||||
const element = urls[index];
|
|
||||||
uploadFile({
|
uploadFile({
|
||||||
path: '/ocr/upload',
|
path: '/ocr/upload',
|
||||||
url: element.tempFilePath,
|
url: urls[0].tempFilePath,
|
||||||
data: {
|
data: {
|
||||||
sessionId: session
|
sessionId: session
|
||||||
}
|
}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
const tmp = JSON.parse(res)
|
const tmp = JSON.parse(res)
|
||||||
reject(tmp)
|
resolve(tmp)
|
||||||
})
|
})
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,4 +66,12 @@ export function sessionAdditiveChemical(params) {
|
|||||||
params: params,
|
params: params,
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function sessionList(params) {
|
||||||
|
return request({
|
||||||
|
path: '/session/list',
|
||||||
|
params: params,
|
||||||
|
method: 'GET'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
28
services/api/user.js
Normal file
28
services/api/user.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import {
|
||||||
|
request,
|
||||||
|
uploadFile
|
||||||
|
} from './request'
|
||||||
|
|
||||||
|
export function userInfoQuery(params) {
|
||||||
|
return request({
|
||||||
|
path: '/wx/userinfo',
|
||||||
|
params: params,
|
||||||
|
method: 'GET'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function userInfoUpdate(params) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
uploadFile({
|
||||||
|
path: '/wx/userinfo',
|
||||||
|
url: params.avatar,
|
||||||
|
data: {
|
||||||
|
nickname: params.nickname
|
||||||
|
}
|
||||||
|
}).then(res => {
|
||||||
|
console.log(res);
|
||||||
|
const tmp = JSON.parse(res)
|
||||||
|
resolve(tmp)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -1,10 +1,14 @@
|
|||||||
import {
|
import {
|
||||||
wxLogin
|
wxLogin
|
||||||
} from '../api/permission'
|
} from '../api/permission'
|
||||||
|
import {
|
||||||
|
setUserInfo
|
||||||
|
} from './user'
|
||||||
|
|
||||||
var token = ''
|
var token = ''
|
||||||
|
|
||||||
export function isLogin() {
|
export function isLogin() {
|
||||||
|
// console.log(token);
|
||||||
if (token == '') {
|
if (token == '') {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
wx.login({
|
wx.login({
|
||||||
@ -14,7 +18,8 @@ export function isLogin() {
|
|||||||
wxLogin({
|
wxLogin({
|
||||||
code: res.code
|
code: res.code
|
||||||
}).then(respose => {
|
}).then(respose => {
|
||||||
token = respose.content.token
|
token = respose.content.token;
|
||||||
|
setUserInfo(respose.content);
|
||||||
resolve(true);
|
resolve(true);
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
41
services/permission/user.js
Normal file
41
services/permission/user.js
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
import {
|
||||||
|
userInfoQuery,
|
||||||
|
userInfoUpdate
|
||||||
|
} from '../api/user'
|
||||||
|
|
||||||
|
const userInfo = {
|
||||||
|
nickname: "",
|
||||||
|
avatar: ""
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setUserInfo(info) {
|
||||||
|
userInfo.avatar = info.avatar;
|
||||||
|
userInfo.nickname = info.nickname;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getUserInfo() {
|
||||||
|
if (userInfo.avatar == '' || userInfo.nickname == '') {
|
||||||
|
userInfoQuery().then(respose => {
|
||||||
|
if (respose.code == 10000) {
|
||||||
|
userInfo.avatar = respose.content.avatar;
|
||||||
|
userInfo.nickname = respose.content.nickname;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const tmp = {
|
||||||
|
...userInfo
|
||||||
|
};
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateUserInfo(info) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
userInfoUpdate(info).then(respose => {
|
||||||
|
if (respose.code == 10000) {
|
||||||
|
userInfo.avatar = info.avatar;
|
||||||
|
userInfo.nickname = info.nickname;
|
||||||
|
resolve(info)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user