123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- <template>
- <div>
- <!--测试-->
- <div style="position: relative;">
- {{testresult}}
- <div @click="testSaveGoods"> 点击测试货品保存testSaveGoods</div>
- <div @click="testReadGoods"> 点击测试货品数据读取 testReadGoods</div>
- <div @click="testSaveReview"> 点击测试货品数据读取testSaveReview</div>
- <div @click="testSaveWxid"> 点击测试货品数据读取testSaveWxid</div>
- <div @click="testReadWxid"> 点击测试WxID读取testReadWxid</div>
- <div @click="testSaveStorage"> 点击写入frontend-userid testSaveStorage</div>
- <div @click="testReadStorage"> 点击读取frontend-userid testReadStorage</div>
- </div>
- <van-button size="large" type="primary" @click="Toindex">返回首页</van-button>
- </div>
- </template>
- <script>
- import {
- Button
- } from 'vant'
- import {BasicFunction} from '../connector/basic-service';
- export default {
- name: "share",
- components: {
- [Button.name]: Button,
- },
- data() {
- return {
- testresult : '正在测试,请稍后',
- active: 0,
- share: require('../assets/post.png'),
- }
- },
- methods:{
- testSaveGoods(){
- window.testvuepage = this;
- BasicFunction.get_data("smartGoods/save", function(response){
- // console.log(response);
- if(response.ret !== "10000"){
- if(response.model.list.length > 0 && response.model === "1"){
- this.testSuccess();
- return;
- }
- this.testFailed();
- }else{
- // Test fail
- this.testFailed();
- }
- })
- },
- testReadGoods(){
- window.testvuepage = this;
- BasicFunction.get_data("smartGoods/list", function(response){
- // console.log(response);
- if(response.ret !== "10000"){
- if(response.model.list.length > 0 && response.model.list[0]["goodId"] != undefined){
- this.testSuccess();
- return;
- }
- this.testFailed();
- }else{
- // Test fail
- this.testFailed();
- return;
- }
- })
- },
- testSaveReview(){
- window.testvuepage = this;
- BasicFunction.get_data("/list", function(response){
- // console.log(response);
- if(response.ret !== "10000"){
- this.testSuccess();
- return;
- }else{
- // Test fail
- this.testFailed();
- return;
- }
- })
- },
- testSaveWxid(){
- window.testvuepage = this;
- BasicFunction.get_data("/list", function(response){
- // console.log(response);
- if(response.ret !== "10000"){
- this.testSuccess();
- return;
- }else{
- // Test fail
- this.testFailed();
- return;
- }
- })
- },
- testReadWxid(){
- window.testvuepage = this;
- BasicFunction.get_data("/list", function(response){
- // console.log(response);
- if(response.ret !== "10000"){
- this.testSuccess();
- return;
- }else{
- // Test fail
- this.testFailed();
- return;
- }
- })
- },
- testSaveStorage(){
- localStorage.setItem("xxx", "333");
- this.testSuccess();
- },
- testReadStorage(){
- window.testvuepage = this;
- if(localStorage.getItem("xxx") === "333") {
- this.testSuccess();
- }else{
- this.testSuccess();
- }
- },
- testSuccess (){
- Toast.success("测试成功", 4000);
- },
- testFail (){
- Toast.fail("测试失败", 4000);
- },
- Toindex(){
- this.$router.push('index');
- }
- }
- }
- </script>
- <style scoped>
- .van-button {
- background-color: #fd6740;
- border-color: #fd6740;
- margin: 10px 0 10px;
- width: 55%;
- }
- div {
- margin-top: 10px;
- background-color: white;
- border: solid 1px;
- padding: 10px;
- }
- </style>
|