Authored by QC-L

添加界面路由跳转逻辑 review by 黄敬囿

... ... @@ -49,6 +49,7 @@ class App extends Component {
'pages/orderDetail/index',
'pages/orderList/orderlistcell',
'pages/orderDetail/logistics/logistics',
'pages/webview/webview'
],
window: {
backgroundTextStyle: 'light',
... ...
... ... @@ -2,6 +2,7 @@ import Taro, {Component} from '@tarojs/taro';
import {View, Text, Image, Navigator} from '@tarojs/components';
import {getImgUrl} from '../../utils';
import './index.scss';
import router from '../../router/index.js'
export default class ProductList extends Component {
constructor(props) {
... ... @@ -14,25 +15,31 @@ export default class ProductList extends Component {
list: []
}
render() {
let {list} = this.props;
goToDetail(product) {
router.go('productDetail', {
id: product.id
});
}
return (
<View className="product-list">
{
list.map(item => {
return (
<View className="product-item" key={item.id}>
<Navigator url={'/pages/productDetail/index?id=' + item.id} hover-class="none">
<Text className="product-price">{item.price ? '¥' + item.price : ''}</Text>
<Image src={getImgUrl(item.default_images, 376, 376)} mode="aspectFill" className="product-img"/>
<Text className="product-name">{item.product_name}</Text>
</Navigator>
</View>
)
})
}
</View>
)
}
render() {
let {list} = this.props;
return (
<View className="product-list">
{
list.map(item => {
return (
<View className="product-item" key={item.id}>
<View onClick={this.goToDetail.bind(this, item)} hover-class="none">
<Text className="product-price">{item.price ? '¥' + item.price : ''}</Text>
<Image src={getImgUrl(item.default_images, 376, 376)} mode="aspectFill" className="product-img"/>
<Text className="product-name">{item.product_name}</Text>
</View>
</View>
)
})
}
</View>
)
}
}
\ No newline at end of file
... ...
... ... @@ -3,7 +3,7 @@ import {View, Text, ScrollView, Image} from '@tarojs/components';
import {getImgUrl} from '../../utils';
import arrowIcon from '../../static/images/arrow-right.png';
import './index.scss';
import NewNavigator from '../navigator/index.js'
import router from '../../router/index.js'
export default class category extends Component {
... ... @@ -17,6 +17,14 @@ export default class category extends Component {
floor: {}
}
goToList(floor) {
router.goUrl(floor.more_url);
}
goToDetail(product) {
router.go('productDetail', { id: product.product_id });
}
render() {
let {floor} = this.props;
let list = floor.list || [];
... ... @@ -30,7 +38,10 @@ export default class category extends Component {
<View className="category">
<View className="floor-header">
<View className="title">{floor.category_name}</View>
<Navigator className="more" url={floor.more_url} hover-class="none">MORE<Image src={arrowIcon} className="arrow-right-icon"/></Navigator>
<View className="more" hover-class="none" onClick={this.goToList.bind(this, floor)}>
MORE
<Image src={arrowIcon} className="arrow-right-icon"/>
</View>
</View>
{
newList.length > 0 &&
... ... @@ -50,15 +61,15 @@ export default class category extends Component {
s.map(item => {
return (
<View className="item" key={item.product_id} key={item.product_id}>
<Navigator className="item-navigator" url={`/pages/productDetail/index?id=${item.product_id}`} hover-class="none">
<View className="item-navigator" onClick={this.goToDetail.bind(this, item)} hover-class="none">
<View className="item-img">
<Image className="img" src={getImgUrl(item.image_url, 140, 140)} mode="aspectFill"/>
<Image className="img" src={getImgUrl(item.image_url, 140, 140)} mode="aspectFit"/>
</View>
<View className="product-dec">
<Text className="item-name">{item.product_name}</Text>
<View className="item-code">货号 {item.product_code}</View>
</View>
</Navigator>
</View>
</View>
)
})
... ...
import Taro, {Component} from '@tarojs/taro';
import {Swiper, SwiperItem, Navigator, Image} from '@tarojs/components';
import {Swiper, SwiperItem, Navigator, Image, Button} from '@tarojs/components';
import {getImgUrl} from '../../utils';
import './index.scss';
import router from '../../router/index';
export default class Focus extends Component {
constructor(props) {
... ... @@ -24,6 +25,10 @@ export default class Focus extends Component {
componentDidHide() {}
goToResource(item) {
router.goUrl(item.url);
}
render() {
let {floor} = this.props;
... ... @@ -35,9 +40,7 @@ export default class Focus extends Component {
floor.map((item, index) => {
return (
<SwiperItem key={index}>
<Navigator url={item.url} hover-class="none">
<Image src={getImgUrl(item.src, 670, 280)} mode="aspectFill" />
</Navigator>
<Image onClick={this.goToResource.bind(this, item)} src={getImgUrl(item.src, 670, 280)} mode="aspectFill" />
</SwiperItem>
)
})
... ...
... ... @@ -2,6 +2,7 @@ import Taro, {Component} from '@tarojs/taro';
import {View, Text, ScrollView, Image} from '@tarojs/components';
import {getImgUrl} from '../../utils';
import './index.scss';
import router from '../../router/index';
export default class HotSeries extends Component {
constructor(props) {
... ... @@ -15,6 +16,13 @@ export default class HotSeries extends Component {
title: '热门系列'
}
goToList(item) {
router.go('productList', {
serise: item.series_id,
name: item.series_name
});
}
render() {
let {floor, title} = this.props;
... ... @@ -33,10 +41,8 @@ export default class HotSeries extends Component {
floor.map(item => {
return (
<View className="item" key={item.series_id}>
<Navigator url={`/pages/searchList/index?series=${item.series_id}&name=${item.series_name}`} hover-class="none">
<Image src={getImgUrl(item.image_url, 140, 140)} mode="aspectFill" className="item-img" />
<Image onClick={this.goToList.bind(this, item)} src={getImgUrl(item.image_url, 140, 140)} mode="aspectFill" className="item-img" />
<View className="item-name">{item.series_name}</View>
</Navigator>
</View>
)
})
... ...
import Taro, {Component} from '@tarojs/taro';
import {Navigator} from '@tarojs/components';
import router from '../../router/index.js'
import './index.scss';
export default class SearchItem extends Component {
... ... @@ -13,17 +14,22 @@ export default class SearchItem extends Component {
list: []
}
goToList(item) {
router.go('productList', {
query: item.search_word
});
}
render() {
let {title, list} = this.props;
return (
<View className="search-item">
<View className="title">{title}</View>
{
list.map(item => {
return (
<Navigator className="list-item" hover-class="none" key={item.order_by} url={`/pages/searchList/index?query=${item.search_word}`}>{item.search_word}</Navigator>
<View className="list-item" hover-class="none" key={item.order_by} onClick={this.goToList.bind(this, item)}>{item.search_word}</View>
)
})
}
... ...
// github: https://github.com/sindresorhus/query-string
// update: https://wzrd.in/standalone/query-string@latest
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r;r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,r.queryString=e()}}(function(){return function e(r,n,t){function o(c,u){if(!n[c]){if(!r[c]){var a="function"==typeof require&&require;if(!u&&a)return a(c,!0);if(i)return i(c,!0);var f=new Error("Cannot find module '"+c+"'");throw f.code="MODULE_NOT_FOUND",f}var s=n[c]={exports:{}};r[c][0].call(s.exports,function(e){var n=r[c][1][e];return o(n?n:e)},s,s.exports,e,r,n,t)}return n[c].exports}for(var i="function"==typeof require&&require,c=0;c<t.length;c++)o(t[c]);return o}({1:[function(e,r,n){"use strict";function t(e){switch(e.arrayFormat){case"index":return function(r,n,t){return null===n?[i(r,e),"[",t,"]"].join(""):[i(r,e),"[",i(t,e),"]=",i(n,e)].join("")};case"bracket":return function(r,n){return null===n?i(r,e):[i(r,e),"[]=",i(n,e)].join("")};default:return function(r,n){return null===n?i(r,e):[i(r,e),"=",i(n,e)].join("")}}}function o(e){var r;switch(e.arrayFormat){case"index":return function(e,n,t){return r=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),r?(void 0===t[e]&&(t[e]={}),void(t[e][r[1]]=n)):void(t[e]=n)};case"bracket":return function(e,n,t){return r=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),r?void 0===t[e]?void(t[e]=[n]):void(t[e]=[].concat(t[e],n)):void(t[e]=n)};default:return function(e,r,n){return void 0===n[e]?void(n[e]=r):void(n[e]=[].concat(n[e],r))}}}function i(e,r){return r.encode?r.strict?u(e):encodeURIComponent(e):e}function c(e){return Array.isArray(e)?e.sort():"object"==typeof e?c(Object.keys(e)).sort(function(e,r){return Number(e)-Number(r)}).map(function(r){return e[r]}):e}var u=e("strict-uri-encode"),a=e("object-assign"),f=e("decode-uri-component");n.extract=function(e){var r=e.indexOf("?");return r===-1?"":e.slice(r+1)},n.parse=function(e,r){r=a({arrayFormat:"none"},r);var n=o(r),t=Object.create(null);return"string"!=typeof e?t:(e=e.trim().replace(/^[?#&]/,""))?(e.split("&").forEach(function(e){var r=e.replace(/\+/g," ").split("="),o=r.shift(),i=r.length>0?r.join("="):void 0;i=void 0===i?null:f(i),n(f(o),i,t)}),Object.keys(t).sort().reduce(function(e,r){var n=t[r];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?e[r]=c(n):e[r]=n,e},Object.create(null))):t},n.stringify=function(e,r){var n={encode:!0,strict:!0,arrayFormat:"none"};r=a(n,r);var o=t(r);return e?Object.keys(e).sort().map(function(n){var t=e[n];if(void 0===t)return"";if(null===t)return i(n,r);if(Array.isArray(t)){var c=[];return t.slice().forEach(function(e){void 0!==e&&c.push(o(n,e,c.length))}),c.join("&")}return i(n,r)+"="+i(t,r)}).filter(function(e){return e.length>0}).join("&"):""}},{"decode-uri-component":2,"object-assign":3,"strict-uri-encode":4}],2:[function(e,r,n){"use strict";function t(e,r){try{return decodeURIComponent(e.join(""))}catch(e){}if(1===e.length)return e;r=r||1;var n=e.slice(0,r),o=e.slice(r);return Array.prototype.concat.call([],t(n),t(o))}function o(e){try{return decodeURIComponent(e)}catch(o){for(var r=e.match(u),n=1;n<r.length;n++)e=t(r,n).join(""),r=e.match(u);return e}}function i(e){for(var r={"%FE%FF":"��","%FF%FE":"��"},n=a.exec(e);n;){try{r[n[0]]=decodeURIComponent(n[0])}catch(e){var t=o(n[0]);t!==n[0]&&(r[n[0]]=t)}n=a.exec(e)}r["%C2"]="�";for(var i=Object.keys(r),c=0;c<i.length;c++){var u=i[c];e=e.replace(new RegExp(u,"g"),r[u])}return e}var c="%[a-f0-9]{2}",u=new RegExp(c,"gi"),a=new RegExp("("+c+")+","gi");r.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(r){return i(e)}}},{}],3:[function(e,r,n){"use strict";function t(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function o(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var r={},n=0;n<10;n++)r["_"+String.fromCharCode(n)]=n;var t=Object.getOwnPropertyNames(r).map(function(e){return r[e]});if("0123456789"!==t.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(e){return!1}}var i=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;r.exports=o()?Object.assign:function(e,r){for(var n,o,a=t(e),f=1;f<arguments.length;f++){n=Object(arguments[f]);for(var s in n)c.call(n,s)&&(a[s]=n[s]);if(i){o=i(n);for(var d=0;d<o.length;d++)u.call(n,o[d])&&(a[o[d]]=n[o[d]])}}return a}},{}],4:[function(e,r,n){"use strict";r.exports=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}},{}]},{},[1])(1)});
... ...
const api = {};
const apiNames = [
'request',
'navigateTo',
'navigateBack',
'redirectTo',
'switchTab',
'showLoading',
'hideLoading',
'navigateToMiniProgram',
'getUserInfo',
'getSetting',
'openSetting',
'showModal',
'login',
'scanCode',
'checkSession',
'setStorage',
'showToast',
'getSystemInfo',
'setClipboardData'
];
apiNames.forEach(key => {
if (typeof wx[key] === 'function') {
api[key] = (params = {}) => {
return new Promise((resolve, reject) => {
console.debug(`call api ${key}: `, Object.assign({}, params));
params.success = res => {
console.debug(`call api ${key} result: `, res);
return resolve(res);
};
params.fail = err => {
console.debug(`call api ${key} error: `, err);
return reject(err);
};
return wx[key](params);
});
};
}
});
export default Object.assign({}, wx, api);
... ...
... ... @@ -6,14 +6,15 @@ import {classify as classifyModel} from '../../models';
import {getImgUrl} from '../../utils';
import './index.scss';
import getPrivateKey from '../../libs/request/getPrivateKey.js'
import router from '../../router/index.js'
export default class Classify extends Component {
constructor() {
super(...arguments);
this.state = {
tabs: ['品类', '品牌'],
actived: '品类',
brandList: []
tabs: ['品类', '品牌'],
actived: '品类',
brandList: []
};
}
... ... @@ -31,13 +32,20 @@ export default class Classify extends Component {
});
}
})
}
}
changeTab(item) {
this.setState({
actived: item
});
}
changeTab(item) {
this.setState({
actived: item
});
}
goToList(brand) {
router.go('productList', {
brand: brand.id,
name: brand.brand_name
});
}
render () {
let {tabs, actived, brandList} = this.state;
... ... @@ -75,13 +83,14 @@ export default class Classify extends Component {
brandList.length > 0 &&
brandList.map((item, index) => {
return (
<Navigator
className={index < num ? 'brand-item border' : 'brand-item'}
key={index}
hover-class="none"
url={`/pages/searchList/index?brand=${item.id}&name=${item.brand_name}`}>
<Image src={getImgUrl(item.brand_logo, 160, 80)} mode="aspectFill" className="brand-img"></Image>
</Navigator>
<View
className={index < num ? 'brand-item border' : 'brand-item'}
key={index}
hover-class="none"
onClick={this.goToList.bind(this, item)}
>
<Image src={ getImgUrl(item.brand_logo, 160, 80) } mode ="aspectFit" className="brand-img"></Image>
</View>
)
})
}
... ...
... ... @@ -8,6 +8,7 @@ import './index.scss';
import { connect } from '@tarojs/redux';
import { loginAction, decodeUnionId, wechatUserIsBind } from '../../libs/login/login.js'
import getPrivateKey from '../../libs/request/getPrivateKey.js'
import router from '../../router/index.js'
@connect(({ filterMenu }) => ({
... ... @@ -138,6 +139,10 @@ export default class Index extends Component {
// <Text onClick={this.gotoNative}>跳转原生页面</Text>
// <Button openType="getUserInfo" onGetUserInfo = { this.login } > 登录 < /Button>
goToSearch() {
router.go('search');
}
render() {
let {tabs, productList} = this.state;
let {filterMenu} = this.props;
... ... @@ -154,7 +159,7 @@ export default class Index extends Component {
<View className="header-nav">
<Text className="page-label">飞碟好物</Text>
<Navigator url="/pages/search/index" className="search" hover-class="none"><Image className="search-btn" src={searchImg}></Image></Navigator>
<View onClick={this.goToSearch} className="search" hover-class="none"><Image className="search-btn" src={searchImg}></Image></View>
</View>
<Resources code={contentCode.index}></Resources>
... ...
... ... @@ -7,6 +7,7 @@
import orderService from '../orderService'
import {getImgUrl} from '../../../utils';
import router from '../../../router/index.js'
Page({
... ... @@ -215,10 +216,7 @@ Page({
},
goProtocol: function () {
wx.navigateTo({
url: '../orderProtocol/orderProtocol'
})
let url = `http://m.yohobuy.com/activity/student/detail/renzhen?openby:yohobuy={\"action\":\"go.h5\",\"params\":{\"url\":\"https://activity.yoho.cn/feature/3189.html?title=买家协议\"}}`;
router.goUrl(url);
},
})
... ...
... ... @@ -38,6 +38,7 @@ export default class SearchList extends Component {
componentDidMount() {
let params = this.$router.params || {};
console.log(params);
let tabs = '';
let obj = {
page: {},
... ... @@ -59,8 +60,13 @@ export default class SearchList extends Component {
tabs = [{type: type}];
this.setState({
pageTitle: params.name
pageTitle: decodeURI(params.name)
});
if (params.productListTitle) {
this.setState({
pageTitle: decodeURI(params.productListTitle)
});
}
}
// 初始化数据
... ...
... ... @@ -13,6 +13,7 @@ import { login as loginModel, personal as personalModel } from '../../models';
import './index.scss';
import event from '../../utils/event.js';
import { getImgUrl } from '../../utils/index.js'
import router from '../../router/index.js'
@connect(({ globalData }) => ({
globalData
... ... @@ -28,20 +29,21 @@ export default class UserCenter extends Component {
{
text: '购买',
num: 0,
page: '../orderList/index',
page: 'orderList',
},
{
text: '通知',
tab: '../message/message/message',
page: 'message',
routerAction: 'switchTab'
},
{
text: '收藏',
num: 0,
page: './collection/collection'
page: 'collection'
},
{
text: '我的资产',
page: '../myassets/index'
page: 'myassets'
},
{
text: '客服与帮助',
... ... @@ -284,29 +286,15 @@ export default class UserCenter extends Component {
}
navigateIsLogin(item) {
if (item && item.page) {
wx.navigateTo({
url: item.page,
});
}
if (item && item.tab) {
wx.switchTab({
url: item.tab,
})
}
this.jumpWithItem(item);
}
navigateLoginSuccess(item) {
if (item && item.page) {
wx.navigateTo({
url: item.page,
});
}
if (item && item.tab) {
wx.switchTab({
url: item.tab,
})
}
this.jumpWithItem(item);
}
jumpWithItem(item) {
router.go(item.page, item.query, item.routerAction);
}
getInfoNum() {
... ...
import {
parse,
stringify
} from '../../libs/request/utils/query-string/query-string.js';
// import config from '../../common/config';
// import udid from '../../common/udid';
// import event from '../../common/event';
// import {
// verify
// } from '../../common/api';
import event from '../../utils/event.js';
// import {
// getQRCodeSource
// } from '../../common/miniQRCodeRoute';
Page({
/**
* 页面的初始数据
*/
data: {
title: '',
url: '',
shareUrl: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options);
options.url = decodeURIComponent(options.url || '');
if (options && options.scene && options.scene.length > 0) {
let code = options.scene;
// getQRCodeSource(code).then(json => {
// console.log('json:', json);
// if (json) {
// this.generateUrl(json);
// }
// }).catch(error => { });
} else {
if (options.url) {
let uid = this.getUid();
const search = options.url.split('?')[1] || '';
const qs = parse(search);
if (Number(qs.needLogin) === 1 && uid === 0) {
event.emit('user-is-login', () => {
}, () => {
this.generateUrl(options);
});
} else {
this.generateUrl(options);
}
}
}
},
/**
* 获取 UID
*/
getUid: function () {
const app = getApp() || {};
return app.globalData &&
app.globalData.userInfo &&
app.globalData.userInfo.uid ?
app.globalData.userInfo.uid : 0;
},
/**
* 取得URL中的参数
*/
getQueryObj(link) {
let loc = decodeURIComponent(link);
let variables = '';
let variableArr = [];
let finalArr = [];
if (loc.indexOf('?') > 0) {
variables = loc.split('?')[1];
}
if (variables.length > 0) {
variableArr = variables.split('#')[0].split('&');
}
for (let i = 0; i < variableArr.length; i++) {
let obj = {};
obj.name = variableArr[i].split('=')[0];
obj.value = variableArr[i].split('=')[1];
finalArr.push(obj);
}
let query_obj = {};
for (let i = 0; i < finalArr.length; i++) {
query_obj[finalArr[i].name] = finalArr[i].value;
}
return query_obj;
},
/**
* 生成链接
*/
generateUrl: function (options) {
console.log(options);
let isSign = true;
if (options.url) {
let queryObj = this.getQueryObj(options.url);
console.log('query=', queryObj);
if (queryObj.title) {
this.setData({
title: queryObj.title
});
}
if (queryObj.shareURL) {
this.setData({
shareUrl: queryObj.shareURL
});
}
if (queryObj.noSign) {
isSign = false;
}
}
console.log('option.url=', decodeURIComponent(options.url));
// const app = getApp() || {};
// let param = {
// app_version: config.apiParams.app_version,
// session_key: app.globalData && app.globalData.sessionKey || '',
// client_type: config.apiParams.client_type,
// udid: udid.get()
// };
// let uid = this.getUid();
// if (uid) {
// param.uid = uid;
// }
let url = options.url;
// let params = verify.computeSecret(param);
const [uri, search] = url.split('?');
const qs = parse(search);
url = uri + '?' + stringify(Object.assign({}, qs));
// console.log('webview-url:', url);
this.setData({
url: url
});
},
bindGetMsg: function (e) {
if (e.detail && e.detail.data && e.detail.data[0] && e.detail.data[0].title) {
this.setData({
title: e.detail.data[0].title,
});
}
},
});
... ...
{}
\ No newline at end of file
... ...
<web-view src="{{url}}" bindmessage="bindGetMsg"></web-view>
\ No newline at end of file
... ...
/* src/pages/webview/webview.wxss */
\ No newline at end of file
... ...
import rules from './rules';
import router from './router'
const urlParse = require('url');
const queryString = require('querystring');
const ACTION_TYPE = {
h5: 'go.h5',
ufo: 'go.ufo'
}
const OPEN_BY_TYPE = {
GO_LIST: 'productList',
GO_ORDER_LIST: 'orderList',
GO_DETAIL: 'productDetail',
GO_ORDER_DETAIL: 'BuyerOrderDetail',
GO_HOME: 'home',
};
export default {
go(name, query, jumpType) {
const jump = jumpType ? jumpType : 'navigateTo';
const rule = rules[name];
if (!rule) {
return Promise.reject(`路由规则未匹配到: ${name}`);
}
query = query || {}
const routerFn = router[jumpType] || router.navigateTo;
return routerFn({
url: rule.path,
query
});
},
goUrl(url) {
const urlObj = urlParse.parse(url); // 使用 node 的 url 库
const queryObj = queryString.parse(urlObj.query); // 使用 node 的 querystring
let yohobuy = {};
let yoho = {};
if (queryObj['openby:yohobuy']) {
yoho = JSON.parse(queryObj['openby:yohobuy']);
}
switch(yoho.action) {
case ACTION_TYPE.h5: {
yohobuy = {
...yoho.params.param,
url: yoho.params.url,
action: yoho.action
}
this.go('webview', yohobuy);
break;
}
case ACTION_TYPE.ufo: {
this.handleUFOJumpPage(yoho);
break;
}
}
},
handleUFOJumpPage(yoho) {
const params = yoho.params
switch(params.pagename) {
case OPEN_BY_TYPE.GO_LIST: {
console.log(yoho);
this.go(OPEN_BY_TYPE.GO_LIST, params);
break;
}
case OPEN_BY_TYPE.GO_HOME: {
this.go(OPEN_BY_TYPE.GO_HOME);
break;
}
case OPEN_BY_TYPE.GO_DETAIL: {
this.go(OPEN_BY_TYPE.GO_DETAIL, params);
break;
}
case OPEN_BY_TYPE.GO_ORDER_DETAIL: {
this.go('orderDetail', params);
break;
}
case OPEN_BY_TYPE.GO_ORDER_LIST: {
this.go(OPEN_BY_TYPE.GO_ORDER_LIST, params);
break;
}
default: break;
}
}
}
\ No newline at end of file
... ...
import wx from '../libs/wx.js'
import { stringify } from '../libs/query-stringify.js';
export default {
navigateTo(params) {
return wx.navigateTo({
url: `${params.url}?${stringify(params.query)}`,
});
},
reLaunch(params) {
return wx.reLaunch({
url: params.url
});
},
redirectTo(params) {
return wx.redirectTo({
url: `${params.url}?${stringify(params.query)}`,
})
},
switchTab(params) {
return wx.switchTab({
url: params.url,
})
}
}
\ No newline at end of file
... ...
export default {
home: {
path: '/pages/index/index'
},
productDetail: {
path: '/pages/productDetail/index',
},
productList: {
path: '/pages/searchList/index'
},
orderList: {
path: '/pages/orderList/index',
neewLogin: true
},
orderDetail: {
path: '/pages/orderDetail/index',
neewLogin: true
},
webview: {
path: '/pages/webview/webview'
},
message: {
path: '/pages/message/message/message'
},
collection: {
path: '/pages/userCenter/collection/collection'
},
myassets: {
path: '/pages/myassets/index'
},
webview: {
path: '/pages/webview/webview'
},
search: {
path: '/pages/search/index'
}
}
\ No newline at end of file
... ...
... ... @@ -6768,6 +6768,7 @@ url-to-options@^1.0.1:
url@^0.11.0:
version "0.11.0"
resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1"
integrity sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=
dependencies:
punycode "1.3.2"
querystring "0.2.0"
... ...