增加其他类型产品的购买

This commit is contained in:
zhl 2019-04-26 13:58:43 +08:00
parent 0f8f276c25
commit 45b0915f83
7 changed files with 180 additions and 16 deletions

145
package-lock.json generated
View File

@ -17,6 +17,17 @@
"uri-js": "^4.2.2"
}
},
"align-text": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz",
"integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=",
"dev": true,
"requires": {
"kind-of": "^3.0.2",
"longest": "^1.0.1",
"repeat-string": "^1.5.2"
}
},
"ansi-regex": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
@ -831,6 +842,12 @@
"electron-to-chromium": "^1.3.47"
}
},
"camelcase": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz",
"integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=",
"dev": true
},
"caniuse-lite": {
"version": "1.0.30000939",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000939.tgz",
@ -844,6 +861,16 @@
"dev": true,
"optional": true
},
"center-align": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz",
"integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=",
"dev": true,
"requires": {
"align-text": "^0.1.3",
"lazy-cache": "^1.0.3"
}
},
"chalk": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
@ -857,6 +884,17 @@
"supports-color": "^2.0.0"
}
},
"cliui": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz",
"integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=",
"dev": true,
"requires": {
"center-align": "^0.1.1",
"right-align": "^0.1.1",
"wordwrap": "0.0.2"
}
},
"clone": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz",
@ -942,6 +980,12 @@
"ms": "2.0.0"
}
},
"decamelize": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
"dev": true
},
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
@ -1130,6 +1174,12 @@
"loose-envify": "^1.0.0"
}
},
"is-buffer": {
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
"dev": true
},
"is-finite": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz",
@ -1223,6 +1273,21 @@
"verror": "1.10.0"
}
},
"kind-of": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
"integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
"dev": true,
"requires": {
"is-buffer": "^1.1.5"
}
},
"lazy-cache": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz",
"integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=",
"dev": true
},
"less": {
"version": "3.9.0",
"resolved": "https://registry.npmjs.org/less/-/less-3.9.0.tgz",
@ -1246,6 +1311,12 @@
"integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==",
"dev": true
},
"longest": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz",
"integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=",
"dev": true
},
"loose-envify": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
@ -1454,6 +1525,12 @@
"jsesc": "~0.5.0"
}
},
"repeat-string": {
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz",
"integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=",
"dev": true
},
"repeating": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz",
@ -1492,6 +1569,15 @@
"uuid": "^3.3.2"
}
},
"right-align": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz",
"integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=",
"dev": true,
"requires": {
"align-text": "^0.1.1"
}
},
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
@ -1636,6 +1722,32 @@
"integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=",
"dev": true
},
"uglify-js": {
"version": "2.8.29",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz",
"integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=",
"dev": true,
"requires": {
"source-map": "~0.5.1",
"uglify-to-browserify": "~1.0.0",
"yargs": "~3.10.0"
},
"dependencies": {
"source-map": {
"version": "0.5.7",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
"dev": true
}
}
},
"uglify-to-browserify": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz",
"integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=",
"dev": true,
"optional": true
},
"uri-js": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",
@ -1699,6 +1811,15 @@
"integrity": "sha512-70n7Rb0i987RBun9EC+aTBHsscwSb6Vb4r7l+dgOy2KGyyvPvmhh2vSQduxFnhJzHuYRYMV+hxH51Jss+jE+vg==",
"dev": true
},
"wepy-plugin-uglifyjs": {
"version": "1.3.7",
"resolved": "https://registry.npmjs.org/wepy-plugin-uglifyjs/-/wepy-plugin-uglifyjs-1.3.7.tgz",
"integrity": "sha512-PUYVrAeF8Xgb8dmSP31Y50NggJtsI1IFYXGA04fpLaCy+TKnGetiXhZ4t7bHShA417LDgqOnLd2ABjbhxaM/pA==",
"dev": true,
"requires": {
"uglify-js": "^2.7.5"
}
},
"which": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
@ -1707,6 +1828,30 @@
"requires": {
"isexe": "^2.0.0"
}
},
"window-size": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz",
"integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=",
"dev": true
},
"wordwrap": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz",
"integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=",
"dev": true
},
"yargs": {
"version": "3.10.0",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz",
"integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=",
"dev": true,
"requires": {
"camelcase": "^1.0.2",
"cliui": "^2.1.0",
"decamelize": "^1.0.0",
"window-size": "0.1.0"
}
}
}
}

View File

@ -31,6 +31,7 @@
"cross-env": "^5.1.3",
"less": "^3.8.1",
"wepy-compiler-babel": "^1.5.1",
"wepy-compiler-less": "^1.3.10"
"wepy-compiler-less": "^1.3.10",
"wepy-plugin-uglifyjs": "^1.3.7"
}
}

View File

@ -6,12 +6,15 @@
"postcss": false,
"minified": false,
"newFeature": true,
"autoAudits": false
"autoAudits": false,
"checkInvalidKey": true
},
"compileType": "miniprogram",
"appid": "wx815bf59d472c0a63",
"projectname": "gamemall",
"miniprogramRoot": "dist/",
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {
"search": {
"current": -1,

View File

@ -42,7 +42,8 @@ export default class extends wepy.app {
globalData = {
userInfo: null,
gameToken: null
gameToken: null,
dataType: 'game'
}
constructor () {
@ -63,6 +64,8 @@ export default class extends wepy.app {
if (token) {
p.header['Authorization'] = `JWT ${token}`;
}
(p.data) || (p.data = {});
(p.data.data_type) || (p.data.data_type = this.globalData.dataType);
return p;
},
success(response) {
@ -91,16 +94,10 @@ export default class extends wepy.app {
if (options.scene === 1037) {
let params = options.query;
this.globalData.gameToken = params.token;
this.globalData.dataType = params.dataType;
}
}
sleep (s) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve('promise resolved')
}, s * 1000)
})
}
}
</script>

View File

@ -1,5 +1,6 @@
const env = 'test'; //product
export default {
env: env,
// apiBase: 'http://192.168.100.232',
apiBase: env === 'test'? 'https://ghost-test.kingsome.cn' : 'https://ghost.kingsome.cn',
version: '1.0.1',

View File

@ -124,11 +124,22 @@
this.gid = decodeURIComponent(params.gid);
}
onShow() {
this.vip_price = this.$getPrice('vip_price');
this.vip_discount = this.$getPrice('vip_discount');
this.month_price = this.$getPrice('month_price');
this.month_discount = this.$getPrice('month_discount');
this.vip_img = this.$getPrice('vip_img');
if (this.$parent.globalData.dataType === 'game') {
this.vip_price = this.$getPrice('vip_price');
this.vip_discount = this.$getPrice('vip_discount');
this.month_price = this.$getPrice('month_price');
this.month_discount = this.$getPrice('month_discount');
this.vip_img = this.$getPrice('vip_img');
} else {
const subStr = this.$parent.globalData.dataType + '_'
this.vip_price = this.$getPrice( subStr + 'vip_price');
this.vip_discount = this.$getPrice(subStr + 'vip_discount');
this.month_price = this.$getPrice(subStr + 'month_price');
this.month_discount = this.$getPrice(subStr + 'month_discount');
this.vip_img = this.$getPrice(subStr + 'vip_img');
}
this.$apply();
}
buy(type) {

View File

@ -85,7 +85,13 @@
this.getUserInfo();
}
onShow(){
this.product_img = this.$getPrice('product_img');
if (this.$parent.globalData.dataType === 'game') {
this.product_img = this.$getPrice('product_img');
} else {
const subStr = this.$parent.globalData.dataType + '_'
this.product_img = this.$getPrice(subStr + 'product_img');
}
this.$apply();
}
async showBuyMenu() {